Aggiorna mail-receiver alla versione ufficiale

Se sei arrivato qui perché hai notato questo messaggio nella tua Admin Dashboard:

Abbiamo rilevato una versione obsoleta di mail-receiver..

sei nel posto giusto.

Per favore, accedi via SSH al tuo server Discourse ed esegui i seguenti due comandi per aggiornare mail-receiver:

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

Per ulteriori dettagli, continua a leggere.

Perché dobbiamo aggiornare mail-receiver?

Dobbiamo aggiornare mail-receiver a una versione più recente che non utilizzi un metodo di autenticazione API deprecato.

Quando hai configurato inizialmente mail-receiver, ti è stato chiesto di creare un file containers/mail-receiver.yml contenente un numero di versione hardcoded:

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

Per ricevere aggiornamenti futuri senza dover aggiornare manualmente questo numero, puoi impostare il numero di versione su release invece di specificare una versione specifica.

Modifica /var/discourse/containers/mail-receiver.yml per utilizzare questa immagine base:

base_image: discourse/mail-receiver:release

Se lo desideri, puoi semplicemente eseguire questo comando:

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

per modificare il file per te.

Poi puoi eseguire:

/var/discourse/launcher rebuild mail-receiver

per aggiornare all’ultima versione di mail-receiver.

21 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

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

2 Mi Piace

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 Mi Piace