New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodemailer supports "direct" sending since v0.5.8 #1538

Closed
andris9 opened this Issue Nov 22, 2013 · 14 comments

Comments

Projects
None yet
4 participants
@andris9

andris9 commented Nov 22, 2013

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.

@javorszky

This comment has been minimized.

Member

javorszky commented Nov 23, 2013

OOoooohh... shiny!

@ErisDS

This comment has been minimized.

Member

ErisDS commented Nov 23, 2013

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

  • make sure that direct mail works out of the box
  • remove/reduce all of our messaging around email
  • consider what to do if sendmail is available to upgrade to

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.

@andris9

This comment has been minimized.

andris9 commented Nov 25, 2013

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. abcde@smtptest.ghost.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.

@javorszky

This comment has been minimized.

Member

javorszky commented Nov 26, 2013

That is actually pretty clever. 👍

Also, if memory serves me well, you wrote the nodemailer package, right?

@andris9

This comment has been minimized.

andris9 commented Nov 27, 2013

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.

@ErisDS

This comment has been minimized.

Member

ErisDS commented Nov 27, 2013

@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 👯

@andris9

This comment has been minimized.

andris9 commented Nov 27, 2013

Thanks 😃 Actually the direct transport method was partly implemented because of Ghost - I had the idea for some time by now but never really got implementing it but when I saw how Ghost was trying to check the existence of sendmail I thought that it seems too complicated for such a simple task, email should be much easier to use.

@ErisDS

This comment has been minimized.

Member

ErisDS commented Nov 27, 2013

We agree, but we also understand that this is all very new and some problems just haven't been solved yet. Seeing these features crop up is fantastic, hearing that they were motivated by us is utterly humbling.

Thank you so much!

@javorszky

This comment has been minimized.

Member

javorszky commented Nov 29, 2013

May I play implement direct sending instead of sendmail? :)

@ghost ghost assigned javorszky Nov 29, 2013

@ErisDS

This comment has been minimized.

Member

ErisDS commented Nov 29, 2013

Go for it 👍

@javorszky

This comment has been minimized.

Member

javorszky commented Nov 29, 2013

Wee, thank you :)

javorszky added a commit to javorszky/Ghost that referenced this issue Nov 30, 2013

Replace sendmail with direct in nodemail
Fixes TryGhost#1538.
* upgraded nodemailer to 0.5.11 (current master as of commit)
* implemented direct mail sending, and ripped out sendmail (we don't need sendmail anymore with direct being in place)
* modified tests to look for direct instead of sendmail
@donspaulding

This comment has been minimized.

donspaulding commented Dec 5, 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.

@javorszky

This comment has been minimized.

Member

javorszky commented Dec 5, 2013

Hey @donspaulding,

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

  • they are using a suboptimal method of sending emails, and could they please kindly set up X
  • and even if they do, whether their email was sent / acknowledged, or failed

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. 😄

@javorszky

This comment has been minimized.

Member

javorszky commented Dec 9, 2013

javorszky added a commit to javorszky/Ghost that referenced this issue Dec 15, 2013

Replace sendmail with direct in nodemail
Fixes TryGhost#1538.
* upgraded nodemailer to 0.5.15 (current master as of commit)
* implemented direct mail sending, and ripped out sendmail (we don't need sendmail anymore with direct being in place)
* modified tests to look for direct instead of sendmail
* implemented directmail response data
* made `send` function more promising
* added `successmessage` to successful mail notification function
* added rudimentary error handling for rejected / failed email messages

@ErisDS ErisDS referenced this issue Jul 1, 2014

Closed

[Feature] Multi-User #2982

26 of 26 tasks complete

@ErisDS ErisDS modified the milestones: 0.5.x Feature Release, 0.5 Multi-user Jul 8, 2014

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 2, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 2, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 3, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 3, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 4, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 4, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 4, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 6, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 6, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 7, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 7, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 7, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

javorszky added a commit to javorszky/Ghost that referenced this issue Sep 8, 2014

Replaces sendmail with direct
Closes TryGhost#1538
* rips out sendmail
* adds direct
* updates nodemailer to 0.7.1
* changes unit tests for mail
* changed integration tests for mail
* adds mail api tests

@ErisDS ErisDS closed this in #3915 Sep 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment