Users are troubleshooting an issue where Discourse fails to send emails with a “500 5.5.1 Invalid command” error on a new Digital Ocean install, despite SMTP working via command line and Python scripts. b4oshany uses Mailu as a custom SMTP server with StartTLS on port 587 and initially suspected the % in their password, though it was already quoted. itsbhanusharma suggested quoting the password, and Stephen recommended changing it — which b4oshany tried without success. Eventually, b4oshany resolved the issue by adjusting mail settings, though specifics weren’t shared. NightMachinary also got it working, crediting discourse-doctor for helping diagnose the problem. discoursekomrad seeks the fix, and b4oshany advises testing SMTP first using the Real Python guide linked here, which helped them isolate the issue. The consensus suggests verifying SMTP connectivity independently before configuring Discourse, and using discourse-doctor for debugging.
I’m getting the following error using ./discourse-docker on Digital Ocean after installation
==================== MAIL TEST ====================
For a robust test, get an address from http://www.mail-tester.com/
Or just send a test message to yourself.
Email address for mail test? ('n' to skip) [forum@jamaicans.dev]:
Sending mail to forum@jamaicans.dev. . .
Testing sending to forum@jamaicans.dev using mail.jamaicans.dev:587.
======================================== ERROR ========================================
UNEXPECTED ERROR
500 5.5.1 Invalid command
I wrote a python script to test if it is send emails using the SMTP credentials, and I’m able to send and receive emails. I also tried Telnet, which works. The port is running on 587 with StartTLS. DMARC and SPF has already been setup.
The mail account has a % sign in the password. I noticed in the app.yaml that the passowrd shouldn’t have in a #. Do you think this would be the culprit?
Can you share your Python script? I, too, installed mailu, and I like to test it.
Update: Nevermind, I created it myself via Sending Emails With Python – Real Python. Mailu works (without TLS, as I haven’t figured out how to use letsencrypt with both mailu and caddy), but discourse doesn’t send emails …