How to update mail-receiver to the release version

If you came here because you noticed this message on your Admin Dashboard:

We detected an outdated version of mail-receiver…

You are in the right place.

Please ssh into your discourse server and run the following two commands to update mail-receiver:

sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml
/var/discourse/launcher rebuild mail-receiver

For more details please continue reading.

Why do we need to update mail-receiver?

We need to update mail-receiver to a newer version that doesn’t use a deprecated api authentication method.

When you originally setup mail-receiver you were asked to setup a containers/mail-receiver.yml file that contained a hardcoded version number:

base_image: discourse/mail-receiver:x.x.x

In order to receive future updates without manually updating this number you can update the version number to release rather than specifying a version.

Please edit /var/discourse/containers/mail-receiver.yml to use this base image:

base_image: discourse/mail-receiver:release

If you would like you can simply run this command:

sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml

to edit the file for you.

Then you can run:

/var/discourse/launcher rebuild mail-receiver

to update to the latest version of mail-receiver.

19 Likes

Thanks for the update guide @blake! However, I seem to not have the mail-receiver.yml file in /var/discourse/containers/ for some reason.

root@nomadgate-community-eu:/var/discourse# sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml
sed: can't read /var/discourse/containers/mail-receiver.yml: No such file or directory

For good measure checked typed ls to check what’s actually there:

root@nomadgate-community-eu:/var/discourse/containers# ls
app.yml  app.yml.save

Any idea why there’s no mail-receiver.yml file and what I can do about it? Mail Receiver seems to be working for my community, even without the file…

EDIT: Come to think of it, I don’t think I’ve ever set up “mail-receiver”. I’m using SendGrid’s inbound parse webhook feature, so why am I even seeing this error in my Discourse dashboard?

However, to make that work I am passing the API credentials as URL parameters like so: /admin/email/handle_mail?api_key=xxx&api_username=xxx — will this no longer work? And if so, is there any other way to keep the support for inbound messages via SendGrid?

2 Likes

I agree – I don’t see a containers/mail-receiver.yml file in my Discourse installation. So far I’m not seeing any ill effects.

@dltj Are you also using SendGrid or similar?

Here’s the thing: If you didn’t install the mail receiver you don’t need to upgrade it.

2 Likes

Sure but I’m trying to gather as much info as I can because there may be some changes to query param based api calls depending on support from SendGrid or other providers that you can wire up to use this endpoint.

3 Likes

No, I’m not using SendGrid – this Discourse installation is several years old, and at the time I wrote an AWS Lambda that used the /admin/email/handle_mail API to push incoming mail into Discourse. That Lambda script used Python 2.7, so it is due for a rewrite…probably time to see what my options are now.

Oddly, the “We detected an outdated version of mail-receiver…” is no longer on my Discourse admin dashboard. Huh. Scratch that – the message is still there. Maybe it went away because the Discourse install didn’t receive any inbound messages for a few days on the /admin/email/handle_mail endpoint, but it did when I sent the test message?

Just checked – inbound mail to Discourse still works.

1 Like

Correct. It times out after 24hrs if it hasn’t received any messages.

2 Likes

Ah, I see. So the dashboard warning isn’t that I’m using ‘mail-receiver’…it is that I’m using the now deprecated api_key and api_username as query params to the API endpoint. Okay…simple enough to fix. Thanks for the hints.

3 Likes