I knew this issue which is a known issue and quite easily to meet it. I have read and tried a lot of testings, but I already got stuck on “sending email” this step.
I was following this discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub that here are my steps below.
git clone https://github.com/discourse/discourse_docker.git /var/discourse cd /var/discourse
/samples/ to copy
Please amend the information about your server.
When my app.yml was set
DISCOURSE_HOSTNAME : 'localhost'
And fill up these information
DISCOURSE_SMTP_ADDRESS: XXX DISCOURSE_SMTP_PORT: 587 DISCOURSE_SMTP_USER_NAME: XXX DISCOURSE_SMTP_PASSWORD: XXX DISCOURSE_SMTP_ENABLE_START_TLS: true
The email server is also built on internal network.
In the beginning, it can work. The discourse can correctly send the register email and I can also access the admin like normal.
However, when I set the localhost of HOSTNAME, I cannot use the internal IP (e.g., 10.1.X.X) to access on browser.
So I only amended my DISCOURSE_HOSTNAME and I didn’t modify other information in
DISCOURSE_HOSTNAME : '10.1.3.91'
PS 10.1.3.91 is my internal (local area) IP.
After I changed to this kind of hostname, I can access it on my browser. However, the email server cannot work anymore. I cannot receive the email from discoure.
I tried to send the email via python with my
The script is like below:
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import smtplib content = MIMEMultipart() content["subject"] = "Learn Code With Mike" content["from"] = " (my email) " content["to"] = " (testing email) " content.attach(MIMEText("Demo python send email")) with smtplib.SMTP(host=" (as same as DISCOURSE_SMTP_ADDRESS) ", port="587") as smtp: try: smtp.ehlo() smtp.starttls() smtp.login(" (as same as DISCOURSE_SMTP_USER_NAME) ", " (as same as DISCOURSE_SMTP_PASSWORD) ") smtp.send_message(content) print("Complete!") except Exception as e: print("Error message: ", e)
Then it can work well. Does it prove the email stmp information which is correct and be able to use?
Is there any idea about this issue?
For email server part, I have also tried the
Mailjet but still not work.
DISCOURSE_HOSTNAME is used
localhost, email server can work.
DISCOURSE_HOSTNAME is changed to internal IP (i.e., local area IP), email server cannot work.
Thank you so much!!!