Where do I put the variables for mail-receiver?

I’ve 2 containers setup for my self-hosted website, nginx is setup outside the container.
And 3rd container for this mail setup is created now.
But, can you pls tell from where I can copy the above said variables of my site to be entered into new mail.yml?

1 Like

You need a third container as descibed below this:

2 Likes

Container is already created (it only needed one command). But then as described in above/initial post(s), I’ve to fill 2-3 values/variables in my mail.yml. I was in doubt from where do I copy the value for the same?

I think you’re asking how to find what values you should be setting those variables to. This is mostly explained in the comments around the variables in the file itself and besides the API key, probably you just need to replace discourse.example.com with your own forum’s domain name.

Here is the sample file in GitHub in case that makes it easier to read everything: discourse_docker/samples/mail-receiver.yml at main · discourse/discourse_docker · GitHub

The API key comment directs you to the API section of your forum’s admin interface but it doesn’t talk about what kind should be created. Assuming you haven’t renamed your system user, it should look like this when creating the key: (enter your own description)

Then below that, find and tick receive emails:
image

After saving that, you will be given the API key needed for DISCOURSE_API_KEY.

6 Likes

My app.yml:

  ## Where e-mail to your forum should be sent.  In general, it's perfectly fine
  ## to use the same domain as the forum itself here.
  MAIL_DOMAIN: bathindahelper.com

# uncomment these (and the volume below!) to support TLS 
#  POSTCONF_smtpd_tls_key_file:  /letsencrypt/discourse.example.com/discourse.example.com.key
#  POSTCONF_smtpd_tls_cert_file:  /letsencrypt/discourse.example.com/fullchain.cer
#  POSTCONF_smtpd_tls_security_level: may


  ## The URL of the mail processing endpoint of your Discourse forum.
  ## This is simply your forum's base URL, with `/admin/email/handle_mail`
  ## appended.  Be careful if you're running a subfolder setup -- in that case,
  ## the URL needs to have the subfolder included!
  DISCOURSE_MAIL_ENDPOINT: 'https://bathindahelper.com/admin/email/handle_mail'

  ## The master API key of your Discourse forum.  You can get this from
  ## the "API" tab of your admin panel.
  DISCOURSE_API_KEY: abcdefghijklmnop

I changed 2 values: mail domain (doubt: don’t I prefix my domain name with some word, like ‘mail’ or only ‘m’)? And mail endpoint (doubt: would including only my actual domain name and leaving all the subfolder path up to ‘handle_mail’ as they’re in the sample file, would be ok?)
I am afraid that some more needs to be done here.

And then, I couldn’t find and copy my own site’s api keys (if I click on ‘All Api Keys’, there is only this one api key to be found). Giving screen shot:


And last, I’m in doubt that while setting my dns settings mx record here:
image

can I give 2 diff values to 'Dns Name and to ‘value’?
E.g.

Dns Name: bathindahelper.com
Value: mail.bathindahelper.com

This is one reason that you wanted your site to be at www.bathindahelper.com.

You appear to be using bathindahelper.com to receive mail already, so you need to do something now complicated.

Set the

You’ll need to configure the MAIL_DOMAIN in your mail_receiver.yml to mail.bathindahelper.com. Yes, you can have different values for the A record and the mx record. You already have two mx records for bathindahelper.com you don’t want to change those unless you don’t want to use that mailbox any more.

Add a dns A record for mail.bathindahelper.com with 5.161.135.164.

And an mx record for mail.bathindahelper.com pointing to mail.bathindahelper.com with priority 10.

Generate a new api key and paste it into the file.

./launcher rebuild mail_receiver.

I think that should do it, though it’s the middle of the night and I’m typing on my phone.

2 Likes