Email setup with your existing email server

(Ruxan) #1

Hi guys, i have finished all… and its working good, language and all… but still cannot figure out why mandril and rest of mail server wont send any email from my discourse forum :confused:

then i thought… can i use email server from my existing domain?

i have put all infos but still cannot send any email from my server

forum will not have many sends, its small-based forum

EDIT: i have put settings without ssl, just simple smtp infos and when i test it says SENT! but im not getting anything

(Matt Palmer) #2

What have you put into the config? Have you rebuilt since you edited the config? What do the mail server logs say – does the e-mail even get to the mail server, and if so, what does it do with it once it gets there?

(Blake Erickson) #3

Also are your original issues with Mandrill related to them shutting it down?

(Ruxan) #4

@blake yea my bad, i tried sparkpostmail also…

This is from app.yml

## TODO: The mailserver this Discourse instance will use
DISCOURSE_SMTP_PORT: 2525 # (optional)
DISCOURSE_SMTP_USER_NAME: SMTP_Injection # (optional)
DISCOURSE_SMTP_ENABLE_START_TLS: false # (optional, default true)

And i did ./launcher rebuild app on every change that i did :frowning:

(Jay Pfaffman) #5

Sparkpost should look something like this:

DISCOURSE_SMTP_PORT: 587                       # (optional)
DISCOURSE_SMTP_USER_NAME: SMTP_Injection       # (optional)
DISCOURSE_SMTP_PASSWORD: 789c9e1234ce4e3f501347a8f0b7a087e9f62bb1 # (optional, WARNING the char '#' in pw can cause problems!)
DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

I don’t know whether sparkpost has port 2525 open. TLS & Port 587 is safer/better anyway.

Everything (except the password) should be exactly like that. ./launcher rebuild app and you should be good to go.

The one other tricky thing is that if your Discourse domain is and you’re trying to send mail with, you need to pay attention to this section:

  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  - exec: rails r "SiteSetting.notification_email=''"
  ## After getting the first signup email, re-comment the line. It only needs to run once.

(OG) #6


what is correct way to setup SMTP when i development environment (no app.yml)…?

Should /discourse/config/discourse.config.sample -> discourse.conf be used?

I’m getting error:

og@axii:~/discourse$ rails c
Loading development environment (Rails 4.2.7)
[1] pry(main)> SiteSetting.notification_email
=> ""
[2] pry(main)> SiteSetting.smtp_address
NoMethodError: undefined method smtp_address' for #<Class:0x00557361a3e498> from /home/og/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7/lib/active_record/dynamic_matchers.rb:26:inmethod_missing’

(Jeff Atwood) #7

Mailcatcher, I believe, is used for dev.

(OG) #8

Thx, I see… Localhost:1025
Is there any way to override it in dev? I’d like to have mails sent to real addresses…

In general can you pleas explain why it is not processing discourse.conf when in dev mode?


Sparkpost has port 2525 open. And port 587 is in no way safer/better since port 2525 does exactly the same thing as 587.

(Jay Pfaffman) #10

Sounds true. It wasn’t working for @RuxBux , so it seemed like something to try. Don’t know if they ever figured it out.

(Matt Palmer) #11

Port 587 is much better because it’s the well-known, standardised, SMTP submission port. There’s no standard, to the best of my knowledge, governing what port 2525 should do.

(Jeff Atwood) #12

I beg to differ!

(Matt Palmer) #13

You are a strange person.


The same service is listening on 587 and 2525, so what is the difference? Maybe they even just redirect 2525 to 587 local, so there is absolutely no difference.

Nearly all SMTP providers provide port 2525 as alternative nowadays because a lot of shared hosting providers block all “official” SMTP ports (including 587).

(Eli the Bearded) #15

Here’s a friendly to link to page listing the IANA reservation for port 2525: TCP/UDP Ports -> Port 2525

And here’s the IANA full list, search for 2525 to get a contact name and email address: Service Name and Transport Protocol Port Number Registry

It appears that it was reserved for a successor to this:

(Matt Palmer) #16

Hahaha, V-Chat. I’ll bet that isn’t going to talk SMTP…

Maybe they do, maybe they don’t. The nice thing about using non-standard ports for a given service is, as demonstrated by the IANA registration for 2525, you just don’t know. In my experience, 2525 is more commonly an alternative to 25 (SMTP) rather than 587 (SMTP-submission), but you’ve got to examine each provider’s description of their port 2525 service to be sure.

As far as providers (shared hosting or otherwise) blocking 587, that’s an amazingly incompetent action to take. If you are using a provider that does that, you might want to ponder what else they’re similarly incompetent at, and take your business elsewhere. Or, at the very least, send them a copy of RFC4409 and a pointed question.


I get your point, but we have to take into consideration what is de facto happening, not only what’s wirtten on the paper.

Every SMTP provider, I have used so far, offers 2525 as an alternative to 25 and 587 for submission. So we could also call it a new “standard”, that is not officially written anywhere.

And as for providers blocking 587, I couldn’t find any reasonable reason for that, but there are more and more of them for some reason, that’s why port 2525 actually started being provided by SMTP providers as an alternative.

(Jay Pfaffman) #18

Spam… When people started hijacking people’s computers and using them to deliver mail, they started blocking those ports to keep their network from looking like a spam source. First it was port 25, then spammers started using 587 and I suppose that they’ll next be blocking 2525, which will really mess up people using V-Chat.

(Matt Palmer) #19

Submitting spam over 587 doesn’t make you look like a spammer. The connection is authenticated to a user, they’re the ones on the hook for the spam, not the IP address that made the connection to port 587.

(Jay Pfaffman) #20

Hmm. You’re right. Maybe then the reason organizations filter 587 is that they don’t want you to use any services that are not their own, and hence block all sub-1000 ports. I’ve worked with school districts that restricted everything but 80 and 443, causing me to run ssh on 443, which then caused my organization to think that my machine was hacked since it had an “unsafe” package running on 443.

But we’re far afield from “email setup with your existing email server.” :slight_smile: