Git Product home page Git Product logo

nodemailer's Introduction

Nodemailer

Nodemailer

Send emails from Node.js – easy as cake! 🍰✉️

NPM

See nodemailer.com for documentation and terms.

Tip

Check out EmailEngine – a self-hosted email gateway that allows making REST requests against IMAP and SMTP servers. EmailEngine also sends webhooks whenever something changes on the registered accounts.

Using the email accounts registered with EmailEngine, you can receive and send emails. EmailEngine supports OAuth2, delayed sends, opens and clicks tracking, bounce detection, etc. All on top of regular email accounts without an external MTA service.

Having an issue?

First review the docs

Documentation for Nodemailer can be found at nodemailer.com.

Nodemailer throws a SyntaxError for "..."

You are using an older Node.js version than v6.0. Upgrade Node.js to get support for the spread operator. Nodemailer supports all Node.js versions starting from [email protected].

I'm having issues with Gmail

Gmail either works well, or it does not work at all. It is probably easier to switch to an alternative service instead of fixing issues with Gmail. If Gmail does not work for you, then don't use it. Read more about it here.

I get ETIMEDOUT errors

Check your firewall settings. Timeout usually occurs when you try to open a connection to a firewalled port either on the server or on your machine. Some ISPs also block email ports to prevent spamming.

Nodemailer works on one machine but not in another

It's either a firewall issue, or your SMTP server blocks authentication attempts from some servers.

I get TLS errors

  • If you are running the code on your machine, check your antivirus settings. Antiviruses often mess around with email ports usage. Node.js might not recognize the MITM cert your antivirus is using.
  • Latest Node versions allow only TLS versions 1.2 and higher. Some servers might still use TLS 1.1 or lower. Check Node.js docs on how to get correct TLS support for your app. You can change this with tls.minVersion option
  • You might have the wrong value for the secure option. This should be set to true only for port 465. For every other port, it should be false. Setting it to false does not mean that Nodemailer would not use TLS. Nodemailer would still try to upgrade the connection to use TLS if the server supports it.
  • Older Node versions do not fully support the certificate chain of the newest Let's Encrypt certificates. Either set tls.rejectUnauthorized to false to skip chain verification or upgrade your Node version
let configOptions = {
    host: "smtp.example.com",
    port: 587,
    tls: {
        rejectUnauthorized: true,
        minVersion: "TLSv1.2"
    }
}

I have issues with DNS / hosts file

Node.js uses c-ares to resolve domain names, not the DNS library provided by the system, so if you have some custom DNS routing set up, it might be ignored. Nodemailer runs dns.resolve4() and dns.resolve6() to resolve hostname into an IP address. If both calls fail, then Nodemailer will fall back to dns.lookup(). If this does not work for you, you can hard code the IP address into the configuration like shown below. In that case, Nodemailer would not perform any DNS lookups.

let configOptions = {
    host: "1.2.3.4",
    port: 465,
    secure: true,
    tls: {
        // must provide server name, otherwise TLS certificate check will fail
        servername: "example.com"
    }
}

I have an issue with TypeScript types

Nodemailer has official support for Node.js only. For anything related to TypeScript, you need to directly contact the authors of the type definitions.

I have a different problem

If you are having issues with Nodemailer, then the best way to find help would be Stack Overflow or revisit the docs.

License

Nodemailer is licensed under the MIT No Attribution license


The Nodemailer logo was designed by Sven Kristjansen.

nodemailer's People

Contributors

andris9 avatar artur-krueger avatar bmeck avatar bradwalton avatar dex4er avatar eltociear avatar fresheneesz avatar gabegorelick avatar gevorg avatar github-actions[bot] avatar igorsechyn avatar jdauphant avatar jsdevel avatar jukebox42 avatar killmenot avatar lpatters avatar manuelschneider avatar meteormatt avatar monkeywithacupcake avatar motdotla avatar mtpultz avatar niftylettuce avatar philipproplesch avatar pmalouin avatar popod avatar rolftimmermans avatar skabbes avatar tylerdixon avatar vrevo avatar zwhitchcox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodemailer's Issues

TypeError: Object #<an Object> has no method 'hostname'

version 0.1.7 has an issue with node 0.3.2 where it calls require('os').hostname().

unfortunately in 0.3.2, this method is 'getHostname'.

users my be able to get around this with

oslib = require('os')
if not oslib.hostname?
  oslib.hostname = oslib.getHostname

has no method 'createTransport'

Hello,
I found this error when I launch the app.

        var transport = nodemailer.createTransport("Sendmail", "/usr/sbin/sendmail")
                             ^
TypeError: Object # has no method 'createTransport'

I appreciate any help.
Thanks,
Alex

Message failed: 503 AUTH command used when not advertised

nodemailer.SMTP = {
    host: "mail.example.com",
    port: 587, 
    use_authentication: true,
    user: "[email protected]",
    pass: "examplepass"
}

I'm using above setting and send through Exim MTA . The error appear : Message failed: 503 AUTH command used when not advertised . After doing some research, maybe

  1. Exim 4 requires that AUTH command only be sent after the client issued EHLO - attempts to authenticate without EHLO would be rejected.
  2. That is, AUTH command could not be used unless advertised (through EHLO,
    according to auth_advertise, etc). This behavior was hardened in Exim
    4.20 and is not an option.

I hope this can help you guys debug on this issue.

EPERM at Socket._onConnect

Same code as as https://github.com/andris9/Nodemailer/issues#issue/13 but this time pointed at a remote SMPT server that I can access perfectly via telnet. Node v0.4.2 built on cygwin.

host and port have been set thus:
mailer.SMTP = {
host: 'smtp.bar.com',
port: 25
};

The error returned through the callback is:
Error: EPERM, Operation not permitted
at Socket._onConnect (net.js:576:18)
at IOWatcher.onWritable (net.js:165:12)

Error being emitted from SMTPClient.prototype._handshakeListener, mail still sends

Im connecting to Microsoft Exchange servers, and it's extremely important that these emails send. Well, because of that, I check the result of the send and wait 10 seconds if it fails to try again. Problem being, I'm getting multiple emails. I'd think if the connection times out, as indicated below, that the email wouldn't send, but it appears that it is.

{ 
    stack: [Getter/Setter],
    arguments: undefined,
    type: undefined,
    message: 'Server responded with 451 Timeout waiting for client input' 
}
Trace: 
    at SMTPClient.<anonymous> (/usr/local/lib/node/.npm/nodemailer/0.1.7/package/lib/mail.js:459:21)
    at SMTPClient.emit (events.js:42:17)
    at SMTPClient.<anonymous> (/usr/local/lib/node/.npm/nodemailer/0.1.7/package/lib/smtp.js:289:18)
    at SMTPClient._onData (/usr/local/lib/node/.npm/nodemailer/0.1.7/package/lib/smtp.js:363:18)
    at Socket.<anonymous> (native)
    at Socket.emit (events.js:42:17)
    at Socket._onReadable (net.js:649:14)
    at IOWatcher.onReadable [as callback] (net.js:156:10)

Setting the sending engine globally is prone to error

i.e.

nodemailer.sendmail = true;
nodemailer.SMTP = { host: 'localhost' };

We are using nodemailer on a large project for a major UK Newspaper and have a team to 6 developers working on the same project.

All HTML emails had passed the manual QA process and worked in all mail clients on launch.

There was a minor update and a developer required nodemailer for an alert email and set the engine to sendmail. This then made all instances of nodemailer send via that transport. But as sendmail only causes html email problems in Hotmail (https://github.com/andris9/Nodemailer/issues/44) the problem went undetected.

One work around is to call nodemailer.SMTP = { host: 'localhost' }; before each send but that isn't very nice.

On a major version number update it would be great if you considered removing this in favor of per instance setting. I'd be happy to submit pull request if you agree this would be a better solution.

Here is a gist which shows the problem: https://gist.github.com/1205774

Regards

Paul

http://yuiblog.com/blog/2006/06/01/global-domination/

Microsoft Exchange with high amount of To

I have a company intranet that I'm working with, sending emails to an internal SMTP server. There are multiple Exchange servers, 2007 and 2010 primarily. I ran into an issue when sending to multiple recipients that caused the headers to be displayed in the body portion of the email. It appears that Exchange has trouble with the To: portion of the headers being too long. I fixed the issue by wrapping with \r\n\t after 2 emails in the EmailMessage.prototype.generateAddresses function in lib/mail.js.

Tls ?

Can send using TLS

SMTP Configured
Sending Mail

Nodemailer, 0.1.13; +http://www.nodemailer.org: 1

CONNECTION (1): 220 SAPO.pt PTMailServer ESMTP SPF1
Connection established! (1)
SEND (1):
└──"EHLO sl.pt\r\n"
RECEIVE (1):
└──"250-SAPO.pt PTMailServer\r\n250-AUTH LOGIN PLAIN\r\n250-AUTH=LOGIN PLAIN\r\n250-PIPELINING\r\n250-STARTTLS\r\n250-SIZE 0\r\n250 8BITMIME\r\n" ""
Routing Data (1)
STARTTLS: (1)
SEND (1):
└──"STARTTLS\r\n"
RECEIVE (1):
└──"220 ready for tls\r\n" ""
Routing Data (1)
RECEIVE (1):
└──"\u0016\u0003..(truncated).\u0000" ""

Uncaught Exception TypeError: Cannot call method 'verifyError' of undefined
at SecurePair. (/home/jpaulo/Desktop/testes/ptmailAlert/node_modules/nodemailer/lib/starttls.js:24:37)
at SecurePair.emit (events.js:61:17)
at SecurePair.maybeInitFinished (tls.js:598:10)
at CleartextStream._push (tls.js:269:17)
at SecurePair.cycle (tls.js:574:20)
at EncryptedStream.write (tls.js:96:13)
at Socket.ondata (stream.js:36:26)
at Socket.emit (events.js:81:20)
at Socket._onReadable (net.js:678:14)
at IOWatcher.onReadable as callback

Cant find mimelib-noiconv?

I try to use Nodemailer, but it can not find the mentioned library.

I am on windows, so i cant install it via npm. Tried to search for the library but couldn't find any.
What should I do?

qmail

I was wondering if this package had been used successfully with a quail based system. I get a message failed error. I can get it to work with Marak's mailer, but I'd like to use the HTML feature of this package.

Thanks.

Adding templating functionality

I'm considering adding templating functionality to Nodemailer (similar as it is with node_mailer). Not reaaly sure yet, what would be the best way for it.

Probably something in the lines of

// create template
myTemplate = nodemailer.createTemplate({
    engine: "mustache",
    templateFile: "/path/to/file"
});

// setup mail options with template
mailOptions = {
    ...,
    html: myTemplate({
        name: "Santa Claus",
        title: "mr.",
        phone: "+1 (234) 567 8901"
    })
}

The returned template value would be a function that takes template options as a parameter and returns a paused Stream object, that will start rendering on stream.resume(). Currently html and text options do not accept streams as input but this should not be very hard to change.

Changing timeout?

I keep getting ECONNRESET when I try to use my Gmail SMTP to send emails and I think that it depends on some timeout being exceeded.

Is there a way I could change the timeout?

Multiple configuration profiles

Currently we configure it like this:

nodemailer.SMTP = {
    host: 'smtp.example.com'
}

How about if we could do this (optionally):

nodemailer.SMTP = [] // array
nodemailer.SMTP.push(config.email.host1); // host1 conf is same as normal conf but with name: key
nodemailer.SMTP.push(config.email.host2); // ditto

Then when sending email, we say:

nodemailer.profile('host1').send_email(yada yada);

the profile method would be chainable and would switch the SMTP host configuration on the fly.

What do you think? If there's a better way, sure, please tell me. If this way seems ok, I might give it a shot one of these days. I really need this feature anyway.

Missing stripHtml

Previous versions generated a plain text alternative when only given a HTML body. In 0.3 this disappeared, the whole regex magic used there has gone.

It would be great to have that feature back.

Callback of send_mail is never called.

Hello,

It looks like the callback of send_mail is not called.
My use case is example.js with the Gmail SMTP. The mail is correctly sent but the callback function is never called. Any idea where to look for the issue?

should handle null callbacks

with no callback I get :

/usr/local/lib/node/.npm/nodemailer/0.1.8/package/lib/mail.js:508:25

sometimes you're not interested in the outcome of the callback: maybe set it as a noop function

Remove SMTP logic from EmailMessage

I have a preliminary change that does this, but wanted to bring up some discussion. EmailMessages currently contain the SMTP command pipeline for FROM TO and DATA. This makes it very hard to reuse SMTPClients which may stay open for a long time. There are 2 real alternative solutions:

  • Make EmailMessages accept a client while sending.
  • Remove the SMTP logic from EmailMessage and put it into SMTPClient.

I think the latter makes more sense since you can still give a message to a client after that and will not change the API terribly to the end developer. Ontop of this, the reuse of SMTPClients is a frequent action if you are running services.

This has a side effect of meaning there is a need for message queueing and events.

  • "empty" event when the client has flushed all the messages to a server.
  • _messageQueue for when you have errors to see which messages were left (sending mail callbacks should also fire errors)

This does let us do some things like SMTPClient pooling.

Trouble installing 0.1.18 via npm

I am getting tar: Unexpected EOF in archive on the npm package for 0.1.18, which doesn't happen for 0.1.17 - is it just me or the 0.1.18 npm is corrupt?

Accept Streams for content?

For larger attachments and messages sending 10+Mb can cause jitters in node apps. Would it be possible to support streams, and if so, how would we detect streams?

Content disposition inline

Embeddable files need not to be content-disposition: inline but attachment. Inline means that the file will be shown where defined.

SES Signature Calculations

I may be doing something wrong, but since the configuration is dead simple I figured I would post this.

I am consistently getting the following error with a 403:
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

I have modified the AWSAccessKeyID and AWSSecretKey variables in the /nodemailer/examples/example_ses.js and am running it directly.

Mind you, if I purposefully mess up the key and keyID I get a login error.

mimelib dependency

Wrong enconding because is (suspect) "mimelib-noiconv":"*", until friday (0.1.3) was another version and now (0.1.4) is broken.

SMTP client keeps listening on timeout errors

Hey Andris,

First of all, nice work mate!

I was just trying out Nodemailer for sending SMTP messages (not using auth, but directly to Gmail on port 25) and found out that when a timeout error occurs, the SMTP connection is not closed so the result is that the node process keeps running forever. After a while, the client tries to resend the message but always throws a "connect Unknown system errno 110" exception.

As far as I tested, the only way to fix this was to forcefully destroy() the connection on the SMTPClient.prototype.close() method. I thought of forking and sending a pull request but I'm not sure if that's the best solution -- besides, it's just one line of code. :)

That's all mate, thanks again.

fallback to HELO not work

when use Nodemailer with SMTP server that not implement EHLO like https://github.com/euangoddard/node-smtpevent, error has occurred.

/home/snj14/dev/node/mailtest/node_modules/nodemailer/lib/smtp.js:575
         if(data.match(/PIPELINING/i)){
                 ^
 TypeError: Cannot call method 'match' of null
    at SMTPClient. (/home/snj14/dev/node/mailtest/node_modules/nodemailer/lib/smtp.js:575:17)
    at Object.callback (native)
    at SMTPClient._dataListener (/home/snj14/dev/node/mailtest/node_modules/nodemailer/lib/smtp.js:466:20)
    at SMTPClient. (/home/snj14/dev/node/mailtest/node_modules/nodemailer/lib/smtp.js:645:14)
    at Socket. (native)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:678:14)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

inserting return; after HELO code blocks, seemed to do the trick.

Repeated failure to send mail over Gmail SMTP

I'm using a Google Apps account to send email (well, to try sending anyway). Here's the code I use to send the email. I use this configuration:

  user: '[email protected]',
  pass: 'password',
  ssl: true,
  host: 'smtp.gmail.com',
  use_authentication: true,
  port: 465

I've also set the sender to 'Our Team [email protected]' (i.e., not just email). Rest of the code is a bit longish, so I won't quote here. In essence, I load a template from file, and interpolate data into it. That's why I have a wrapper module that takes care of this[1].

I've got some recursive function that calls the wrapper method until it can successfully send the email (or when it has tried 4 times with increasing time intervals between the tries). All tries fail. Every time, there is no error message, but sent is always false.

How can I troubleshoot this issue? Is it an issue at all?

[1] https://gist.github.com/1113923

child_process not implemented for windows node.js

But I should be able to send mail not using sendmail.
my work around is:

// use sendmail if set
if(exports.sendmail){
      if(process.platform=="win32"){
            console.log("Sendmail unsupported in windows");
      }else{
      var   exec = require('child_process').exec;
    var headers = this.generateHeaders(),
        body = this.generateBody();

    var path = typeof exports.sendmail=="string"?exports.sendmail:"sendmail";
    exec('echo "'+(headers+"\r\n\r\n"+body).replace(/"/g,'\\"')+'" | '+path+" -t", function(error){
        process.nextTick(function(){
            if(error){
                callback && callback(error, null);
            }else{
                callback && callback(null, true);
            }
        });
    });
   return;
 }

Sending MAIL command twice

When talking to a Python SMTP server (i.e. using stmpd.py), the MAIL command is sent twice, which is illegal SMTP. Nodemailer v0.1.9 and Node v0.4.2.

mailer.send_mail({
    //debug: true,
    html: 'Test',
    sender: '[email protected]',
    subject: 'Subject',
    to: '[email protected]'
},function(err, success) {
    if (success) {
        util.log('[INFO] Email sent');
    }
    else {
        // this happens on every error, not just once per attempt
        util.log('[ERROR] Failed to send email: ' + JSON.stringify(err.message || err));
    }
});

generates the following output:

CONNECTION: 220 localhost Python SMTP proxy version 0.2
Connection established!
SEND:
"EHLO [127.0.0.1]\r\n"
RECEIVE:
"502 Error: command \"EHLO\" not implemented\r\n"
SEND:
"HELO [127.0.0.1]\r\n"
SEND:
"MAIL FROM:<[email protected]>\r\n"
RECEIVE:
"250 localhost\r\n"
SEND:
"MAIL FROM:<[email protected]>\r\n"
RECEIVE:
"250 Ok\r\n"
SEND:
"RCPT TO:<[email protected]>\r\n"
RECEIVE:
"503 Error: nested MAIL command\r\n"
17 Mar 16:31:38 - [ERROR] Failed to send email: "503 Error: nested MAIL command"

None

This issue should be deleted. Doesn't belong here.

Unable to send email through gmail

Hey guys,

Just started using the module with nodejs 0.4.10 to do some simple emailing, but I haven't been able to send an email due to the following error:

Error: 530-5.5.1 Authentication Required. Learn more at                              
530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 a9sm3071219icy.6

Before you ask, yes I'm sure my username and password are correct. Anyways, here's the relevant code I'm using:

var nodemailer = require('nodemailer');
nodemailer.SMTP = {
    debug: true,
    host: 'smtp.gmail.com',
    port: 465,
    ssl: true,
    user_authentication: true,
    user: '[email protected]',
    pass: 'mypassword'
};

var testMail = {
    sender: '[email protected]',
    to: '[email protected]',
    subject: 'test 1 2 3',
    body: 'cool!'
};

nodemailer.send_mail(testMail, function(err, success) {
    if (err) {
        console.log('Error msg: ' + err);
    }
    else {
        console.log('Success msg: ' + success);
    }
});

how can I send a image as attachment

As the title said,I can't send a image as attachement. and my code is like this:
var attachment = [
{
'filename':'cat.jpg',
'contents': new Buffer('img',encoding='ascii'),
}
];

mail.send_mail(
{
sender:'[email protected]',
to:'[email protected]',
subject:'none',
attachments: attachment,
body:'a attachment'
},

I tried every kind of encoding,and all failed.
please help me to figure out this problem.

Mechanism for sending in batches?

When sending emails to multiple recipients, is there any way to avoid multiple connection setups/teardowns? Would that even be possible? Maybe SMTP requires a new connection for each "send" operation...

ReadMe Error

You have console.log('Message ' + success ? 'sent' : 'failed'); in a few places in the README example codes. That should be changed to console.log('Message ' + (success ? 'sent' : 'failed')); due to operator precedence.

Is SMTP required?

I'm wondering if I have to setup SMTP just to send mail using the default server postfix setup. I'm trying to move from mailing use bash or PHP to node.js. Can this package call a command-line mail -s "something" -m "message" [email protected] or something and skip the SMTP stuff?

Or am I thinking about this wrong?

subject is not escaped

Use Case:

subject = '[Support] ' + message.slice(0, 40) + '...'

Suppose that message is

"Hey,\nBob here."

Characters such as newlines which are not allowed in the subject should be escaped or replaced

"Hey, Bob here." // preferred

or

"Hey,\\nBob here." // accurate, catches developers attention

Transport.close() callback breaks examples

With the new callback parameter in Transport.close() as of 2/10, the examples in README.md break because the callback is undefined.

TypeError: undefined is not a function
    at Transport.close (./node_modules/nodemailer/lib/transport.js:71:9)

not waiting 220 from server before first EHLO

Hi there

I dont know is this is official SMTP protocol behavior or another exim4 requirement...

Look like nodemailer doesnt wait for the server GREETING before sending the first EHLO which breaks in some case with exim4 smtp.

this could ends up with errors like this (exim log) :

2011-12-26 19:32:15 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=localhost [127.0.0.1] input="EHLO xxxxx.kimsufi.com\r\n"

smtp.js log :

SEND:
"EHLO xxxxxx.kimsufi.com\r\n"
RECEIVE:
"554 SMTP synchronization error\r\n"
--> mail error: [Error: Server responded with 554 SMTP synchronization error]

with a little timeout it works, but looks dirty to me... ny better idea ?

Thanks !

STARTTLS connection: 503 Command sequence error + fix

I'm connecting to the SMTP server at 1and1 internet. Here is the debug output:

CONNECTION (1): 220 smtp.perfora.net (mrus4) Welcome to Nemesis ESMTP server
Connection established! (1)
SEND (1):
└──"EHLO [127.0.0.1]\r\n"
RECEIVE (1):
└──"250-smtp.perfora.net\r\n" ""
RECEIVE (1):
└──"250-STARTTLS\r\n250-AUTH LOGIN PLAIN\r\n250-AUTH=LOGIN PLAIN\r\n250-PIPELINING\r\n250-SIZE 120000000\r\n250 HELP\r\n" "250-smtp.perfora.net\r\n"
Routing Data (1)
STARTTLS: (1)
SEND (1):
└──"STARTTLS\r\n"
RECEIVE (1):
└──"220 OK\r\n" "250-smtp.perfora.net\r\n"
Routing Data (1)
RECEIVE (1):

...... Certificate data ..........

SEND (1):
└──"AUTH PLAIN bxxxxxxxxx==\r\n"
RECEIVE (1):
└──"503 Command sequence error\r\n" ""

I think that this is related to issue #18, where the server needs another EHLO to get going. I got the latest code, but the additional HELO was not being sent.

I debugged a little and discovered that the connection was 'authorized' so the callback was not being made. Here is the patch that got things working for me:

diff --git a/lib/smtp.js b/lib/smtp.js
index 8a65724..65ba8a8 100644
--- a/lib/smtp.js
+++ b/lib/smtp.js
@@ -532,7 +532,7 @@ SMTPClient.prototype._starttlsHandler = function(callback){
this.ignore_data = false;
this._data_remainder = "";
this.emit("connection_stable");

  •        if(!this._connection.authorized && this.options.use_authentication) {
    
  •        if(this._connection.authorized && this.options.use_authentication) {
             callback();
         }
    

I don't know if this breaks any other scenarios, but the change gets TLS working for me.

Problem with line break in "body:"

If you try to send a message with line breaks

"Hello!

How are you!?

Cheers!"

Occour an error!

The same message:

"Hello! \n\nHow are you!?\n\nCheers!"

Its ok!

Can you fix it!? Thanks!

html is broken

Everything was working as expected but suddenly 'npm update' broke html messages, now this mail does not contain any html at all. Only the plain text is visible, what's wrong?

new nodemailer.send_mail({
    sender : 'test <[email protected]>',
    to : [email protected]'
    subject : 'process exited abnormally',
    body : 'unformatted text',
    html : '<strong>this is a <em>formatted</em> text</strong>'
},function(err, msg) {
    if (err) util.log('Error sending email: ' + err.toString());
});

EDIT:

Even new lines get removed using plain text.

I'm using a gmail account.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.