Test & activation emails are sent with port 4000 included

The odd thing is that it’s port 4000. That’s used for Unicorn, not the dev-mode webserver (which defaults to 3000, as does SiteSetting.port)…

Anyway, try:

/var/discourse/launcher enter app
rails c 
SiteSetting.port = ""
SiteSetting.force_hostname = ""
SiteSetting.queue_jobs = true