Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Nodemailer supports "direct" sending since v0.5.8 #1538
Currently if mail settings are not configured and sendmail command can not be found, sending e-mails is disabled.
Underlying Nodemailer includes a new transport mechanism callled direct since v0.5.8 that is able to send e-mails directly without any relays by connecting to the recipients MX server. If sendmail is not found, this transport mechanism could be used by Ghost instead of disabling all mail.
This is amazing and pretty much changes everything about how we handle mail. Fantastic news.
We're gonna need to do a couple of things to get this up to scratch
Once we add email functionality which is more taxing, such as subscribe to a blog by email, we'll need to re-add the messaging such that the feature can only be properly enabled if a proper mail configuration is available.
You could consider creating an endpoint server for testing e-mail configuration - you set up a SMTP server at known address (for example smtptest.ghost.org) that all Ghost installations can use. This server would not be an actual but a mock server that accepts all emails automatically, sends messages to /dev/null and stores the recipients address used for reference.
When a Ghost installation wants to check if e-mail configuration is setup properly, it tries to send a mail to this server using an unique id as username (ie. firstname.lastname@example.org) and afterwards polls http url smtptest.ghost.org/check/abcde for some time - if the server has recived a message to an user "abcde" then the setup is valid. If some time has passed and the email is not yet received (if a relay service is used, the messages might have a little delay and not transferred instantly), the setup is considered faulty.
Yeah, Nodemailer is one of my node.js modules.
And just to clarify my previous idea about email test server - using http url polling instead of callback urls (which would be more effective than polling) to check if the test message was received or not is needed because polling works everywhere including virtualbox/vagrant machines and callback urls do not.
But this is just an idea I had when I looked up how Ghost treats e-mail. Setting up a canonical test host is a long time commitment and thus should be considered thoroughly as the gains might not exceed the costs.
@andris9 have a
It's super exciting to see this functionality arriving in Node land. The test server is something we are considering internally. I'm not sure we really need it for the amount that Ghost uses email right now - just for forgotten password emails, but we are going to want to offer the ability to subscribe via email etc, at least via apps and I think offering a test service will be a big asset for users who make heavy use of email features.
@JohnONolan and I cannot wait to switch Ghost over to use the direct transport by default, this is going to make Ghost SO MUCH EASIER for new users.
It also means that it makes sense to have a welcome email.
I'm totally stoked
referenced this issue
Nov 30, 2013
added a commit
Nov 30, 2013
May I interject with a small word of caution?
In general, sending email and ensuring delivery to the recipients is a Really Hard Problem. Mailgun (and its competitors) has a business model not just because of shiny APIs and interfaces, but because every email server out there that receives mail has different requirements of the sending server. Reverse PTR entries, checking that the From address is resolvable, checking that the HELO command comes from the same host as the connection originated on. It's a bunch of DNS and server setup that goes way beyond the scope of "setting up a blog".
And if you're going to go to all the trouble to make sure you have a host that can send email reliably, you're probably not going to do it just for Ghost, you either already have it for some other purpose, or you'll want to reuse your "Ghost Mailer" for sending other mail.
I would definitely not make "direct" mailing the default, I would still strongly encourage those who don't want to setup their email server to use a Mailgun-like provider. If people don't want to send mail through Mailgun, they should be encouraged to setup their own server (and take on all the responsibility that entails). And finally, as a last resort, enable direct mail for emailing of known addresses.
If the info helps, I'm happy, if not, feel free to ignore it.
Thank you for that. We know of, and use mailgun and sendgrid. My preferred method is actually to use sendgrid, as they have a 200 a day free tier, which is pretty sweet I think.
The whole purpose of the direct is to help people who can not for some reason set up sendgrid - either by being afraid of the command line, or didn't think of it.
The changes I will be implementing shortly (possibly Sunday, as company xmas will be happening) will be to tell users that
Anything else besides that is not in the scope of a direct transfer, but I'm somewhat confident I can achieve this with it :). Or at least have a whole list of hard facts why I can't if I can't, which to me is equally as important.
I do appreciate your feedback though, and genuinely thank you.