marak / node_mailer Goto Github PK
View Code? Open in Web Editor NEW## Project deprecated, see README
License: MIT License
## Project deprecated, see README
License: MIT License
@ the risk of being called stupid..
Shouldn't the application of the cached template be assigned to the html part of the message instead of to the body (Line: 109) to keep it in synch with the behavior of the not yet cached template assignment (Line: 144)?
Hi! I'm getting an error "ReferenceError: hostClients is not defined":
/.../node_modules/mailer/lib/node_mailer.js:68
delete hostClients[options.user];
^
ReferenceError: hostClients is not defined
at SMTPClient.<anonymous> (/.../node_modules/mailer/lib/node_mailer.js:68:6)
at SMTPClient.emit (events.js:61:17)
at SMTPClient._flushMessages (/.../node_modules/mailer/node_modules/nodemailer/lib/smtp.js:146:14)
at Object.callback (/.../node_modules/mailer/node_modules/nodemailer/lib/smtp.js:235:22)
at SMTPClient._dataListener (/.../node_modules/mailer/node_modules/nodemailer/lib/smtp.js:468:20)
at SMTPClient.<anonymous> (/.../node_modules/mailer/node_modules/nodemailer/lib/smtp.js:643:14)
at Socket.<anonymous> (native)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:676:14)
at IOWatcher.onReadable [as callback] (net.js:177:10)
I just tried without SMTP auth and tried with my local ISP:
email.send({
ssl: false,
host : "smtp.saunalahti.fi", // smtp server hostname
port : 587, // smtp server port
domain : "[127.0.0.1]", // domain used by client to identify itself to server
to : "[email protected]",
from : "[email protected]",
subject : "node_mailer test email",
reply_to:"[email protected]",
body: "Hello! This is a test of the node_mailer."
});
I've made a simple proxy server to test http APIs. It takes contents of http requests and forwards them to e-mail. The problem occurs when it tries to send an e-mail containing binary data. The mailer just hangs with no exception nor warning. No further e-mails are sent, process is not killed and log file is clean.
Is it possible to do DomainKeys Indentified Mail with node-mailer? It is described here:
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html (number 2).
If it isn't possible, what can I do to help make it happen? Or this something that should happen through my smtp server?
hi,
I am trying to send a Email by using the following code:
var email = require("./mailer/lib/node_mailer");
email.send({
host : "smtp.xyz.com", // smtp server hostname
port : "25", // smtp server port
ssl: false, // for SSL support - REQUIRES NODE v0.3.x OR HIGHER
domain : "xyz.com", // domain used by client to identify itself to server
to : "[email protected]",
from : "[email protected]",
subject : "Hello World",
body: "Hello! This is a test of the node_mailer.",
authentication : "login", // auth login is supported; anything else is no auth
username : "[email protected]", // username
password : "password" // password
},
function(err, result){
if(err){ console.log(err); }
});
On executing the script, i get the following error message:
{ stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: 'Server responded with 550 esmtp: protocol deviation\r\n' }
How do i solve this ?
Thanks
We removed templates when we did a the refactor to version 5. We need to add these back in ASAP.
Hey,
I'm getting the following response from the server when I try to send a mail via node_mailer:
235 2.7.0 Authentication successful
555 5.5.4 Unsupported option: [email protected]
503 5.5.1 Error: need MAIL command
503 5.5.1 Error: need RCPT command
221 2.7.0 Error: I can break rules, too. Goodbye.
So it looks like my mailserver does not understand the commands node_mailer is sending?
Mailer works just unti version 1.24 of node_mailer.
I think its wrong has in the package.json depedencies with >=. This cause insecure updates of dependencies. It
s better commit a new package.json when confirm that everything is OK in the test with the new depedencies.
The most of projects doing that, use >=
=/
After upgrading to latest mailer module i am getting below error
{ stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: '535 Authentication Failed\r' }
So, i downgraded mailer module to older version it is working fine.
I'm not 100% confident in our current implementation of SMTP. We should review the STMP logic and compare it against:
https://github.com/andris9/Nodemailer/blob/master/lib/smtp.js
and
https://github.com/dresende/node-smtp/blob/master/lib/smtp.js
We should then determine the best one and implement. The licenses for both of those libraries allow us to re-use the code, so if we decide to use one of the other implementations, we should maintain upstream commits ( if applicable ).
Hi,
I'm trying to send an email via SendGrid, but I keep getting a {message:"could not connect"} error.
Here's my test program:
var inspect, opts, puts, sys;
sys = require('sys');
puts = sys.puts, inspect = sys.inspect;
opts = {
host: "smtp.sendgrid.net",
port: "25",
domain: "smtp.sendgrid.net",
authentication: "login",
username: new Buffer("My SendGrid Username").toString("base64"),
password: new Buffer("My SendGrid Password").toString("base64"),
to: "My Email Address",
from: "[email protected]",
subject: "Node.js Test Email",
body: "Do it, dawg!"
};
puts("send options: " + (inspect(opts)));
require('mailer').send(opts, function() {
return puts(inspect(arguments));
});
Any ideas of what I can try to fix this? FYI, I'm running node v0.2.6 and mailer v0.4.4.
Thanks!
Basically, extend the options configuration dictionary to support some sort of "secure" parameter which is either set to "false" or to a crypto credentials object which can then automatically be used if the server supports TLS. This gist is a good starting point: https://gist.github.com/312809. Obviously, things have changed a bit, but the core of the functionality is the same.
Having a working GMail demo would be great for node_mailer. :)
Hi,
Just an FYI, I've noticed that mailer does not conform to RFCs by not waiting for the HELO before proceeding to send data to the SMTP server.
I am getting the following error when I try to send to an exim4 server. This problem is indicative of not waiting for HELO before sending.
SMTP protocol synchronization error (input sent without waiting for greeting)
I would like to use mailer but I will need to look for a different solution until this problem is fixed.
Cheers,
Matt
In /lib/node_mailer.js:68
the hostClients variable is not in scope here.
My email templates contains multiple lines but I receive the message in one line.
My message template is:
Hello {{name}}!
Start your session with your friends by going to following URL:
{{sessionUrl}}
But I receive my message as:
Hello James! Start your session with your friends by going to following URL: http://theurl.com
Any ideas why this is happening? I tried to view the message from webmail and same thing happens there too.
I tried to check issues from nodemailer and mustache.js in case if someone has reported about the same problem but no results..
Hey, just came in and wanted to say keep up the good work! Thanks!
Many systems do not run an SMTP server and instead deliver mail locally or relay to a remote SMTP server using /usr/sbin/sendmail binary.
It would be very useful in many environments to send mail directly using /usr/sbin/sendmail without requiring TCP overhead of localhost connections, and to maintain a secure server environment without any mail daemons running.
Examples of such programs include sSMTP, msmtp, Postfix with /usr/sbin/sendmail binary replacement, or even sendmail configured only as a local relay agent.
How difficult would it be to implement a sendmail method in addition to SMTP?
Okay, there have been a lot of tickets opened regarding better error handling for connections and for sending emails. I'm closing all of these tickets and forwarding them here.
In v0.5.0 of node_mailer we will address some fundmental API changes that will alleviate a lot of the issues being experienced. We will also be introducing some new features that will make the experience of sending mail a bit more pleasant.
I wanna print this Hi
I'm a ex
am
I try with '
' and '\n' but I was not successful
Is it possible to add a reply-to header? It would be very useful and is a common feature for many mailing libraries/modules.
I've had a case where two different errors with my smtp server were both resulting in unhandled exceptions that crashed node.
v0.6.4 and node 0.4.8
// First problem happened when Google blocked our account, but this was causing node_error to throw an async unhandled exception
FATALNODEERROR::2011-08-04T06:41:48
STACK:Error: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 q4sm1075005ib
b.49
at SMTPClient._dataListener (/usr/local/lib/node/mailer/node_modules/nodemail
er/lib/smtp.js:466:29)
at SMTPClient. (/usr/local/lib/node/mailer/node_modules/nodemailer/lib/smtp.js:643:14)
at CleartextStream. (native)
at CleartextStream.emit (events.js:64:17)
at CleartextStream._push (tls.js:299:12)
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:64:17) at Socket._onReadable (net.js:678:14)
ARGUMENTS:
TYPE:
MESSAGE:535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 q4sm1075005ib
b.49
TOSTRING:Error: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 q4sm1075005ib
b.49
// Second problem was when we switched to a local mail server (exim4) for sending mail and we got this problem
FATALNODEERROR::2011-08-04T07:11:53
STACK:Error: Server responded with 421 admin-01 lost input connection
at SMTPClient._handshakeListener (/usr/local/lib/node/mailer/node_modules/nod
emailer/lib/smtp.js:502:21)
at SMTPClient. (/usr/local/lib/node/mailer/node_modules/nodemailer
/lib/smtp.js:628:21)
at Socket. (native) at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:678:14) at IOWatcher.onReadable as callback
ARGUMENTS:
TYPE:
MESSAGE:Server responded with 421 admin-01 lost input connection
TOSTRING:Error: Server responded with 421 admin-01 lost input connection
For whatever reason, text files that are parsed by mustache are rendering new lines as spaces on output. When I parse files using some other mustache implementation (Hogan.js, e.g.), this does not occur.
Hi there,
I tried things out and they work in telnet, but I keep unrecognized command errors when I try to send the username and the password with stream.write(), no matter in what form.. (base64, buffer, etc.)
Do you have any idea what can be wrong?
This is the response:
data: 220 ns1.mydomain.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.7381 ready at Thu, 9 Dec 2010 17:46:48 -0500
data: 250 ns1.mydomain.com Hello [184.106.136.245]
data: 334 VXNlcm5hbWU6
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
250 2.1.0 [email protected] OK
550 5.7.1 Unable to relay for [email protected]
554 5.5.2 No valid recipients
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
500 5.3.3 Unrecognized command
250 2.0.0 Resetting
221 2.0.0 ns1.mydomain.com Service closing transmission channel
Thx
Is it possible to allow for rendering of additional formats instead of just Mustache (ie. EJS, Jade, etc.)? My project does not use mustache, and it seems silly to use it only for this purpose?
Thanks
Callback style error handling for sending out emails doesn't make much sense.
We should switch an EventEmitter based API so the email object will emit success, error, etc.
This is with the latest latest code from git, in /var/log/exim4/rejectlog:
2011-01-28 10:48:33 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=localhost [127.0.0.1] input="helo localhost\r\nmail from: [email protected]\r\n"
Hello,
just trying your lib, I can't even send a mail...
Got the error:
{ stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: '503 sender not yet given\r' }
Here is my test file :
var email = require("mailer");
email.send({
host : "localhost", // smtp server hostname
port : "25", // smtp server port
to : "[email protected]",
from : "root",
subject : "node_mailer mémé test email",
body: "Hello! This is a test & bière of the node_mailer."
},
function(err, result){
if(err){ console.log(err); }
});
(Ubuntu, email server on localhost is exim).
regards,
Mickael
I have require the mailer just once.
Created two json with configuration to each email to send.
I sent one just after the other, like this:
m.send( json1 );
m.send( json2 );
the problem: emails arrive with the same subject.
Is needed to do two requeires?
I am using node_mailer with express to send e-mails. The problem occurs the first time I send an e-mail after I start the application. The second time is ok, but at the first one nothing happens.
Did it happen to anyone else?
Everything right now is stuck together in one file, we should break this file apart.
seems like a bad api choice. should have it pass in passwords as plaintext here, and have the module itself base64 encode it.
Hey guys, while not directly related to node_mailer I just can't find any information on which node.js hosting solutions actually support smtp - and figured this would be the best place to ask.
Turns our that the joyent no.de smart machines don't! And it's only available in their premium solutions - which don't function in the same way as their no.de offering - so bugger.
So... any ideas?
I first want to say that I love your node mailer, it is fast and very versatile, it fits my needs very well. My only issue with your mailer is that it does not currently support BCC (blind carbon copy) as one of the fields. If you could add this, I would be elated!
Getting the following when I fire off emails inside a loop with 11+ iterations (i.e., 10 or fewer iterations doesn't generate this warning):
c$ node mailer-test.js
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace:
at SMTPClient.<anonymous> (events.js:133:17)
at SMTPClientPool.send (/Users/c/dev/mailer-test/node_modules/mailer/lib/node_mailer.js:72:10)
at dispatchMail (/Users/c/dev/mailer-test/node_modules/mailer/lib/node_mailer.js:112:12)
at Object.node_mail [as send] (/Users/c/dev/mailer-test/node_modules/mailer/lib/node_mailer.js:159:5)
at Object.<anonymous> (/Users/c/dev/mailer-test/mailer-test.js:5:10)
at Module._compile (module.js:425:26)
at Object..js (module.js:443:10)
at Module.load (module.js:344:31)
at Function._load (module.js:303:12)
at Array.0 (module.js:463:10)
To be clear, everything works (emails are sent)--just reporting the memory leak warning. Maybe a false positive?
Tested with mailer 0.6.7 and node 0.5.7 (darwin) / 0.6.3 (win32) using the following:
var mailer = require('mailer');
for(var i = 0; i < 11; i++) { // Change 11 to 10 and warnings no longer appear
mailer.send({
to: 'Some Body <[email protected]>',
from : 'Me <[email protected]>',
subject: 'Test '+i,
body: 'Blah',
host : "xxx",
port : "465",
ssl: true,
authentication : "login",
username : "xxx",
password : "yyy"
},
function(err, result){
if(err){ console.log(err); }
}
);
}
SMTPClient is removed from nodemailer 0.2.0, causing havoc.
Hello,
Is it possible to specify a fromname parameter?
Thank you,
Phil
Hey guys, I just wanted to let you know that Nodemailer v0.3 supports connection pooling and file streaming out of the box, maybe you'd want to check it out - https://github.com/andris9/Nodemailer
I also divided all the operations into separate modules (one for generating rfc formatted message streams, one for handling SMTP and such, there's even a possibility to create custom SMTP servers for testing purposes), if you'd rather be interested not to use the whole Nodemailer package but only some parts of it.
Best regards,
Andris
Right now the API requires that the email and connection are specified every-time. Internally, we are caching the connection, but I don't think this is the best API.
I think we should switch to creating a connection, and then pumping messages through that connection.
Are any of the other mailer libraries good enough to warrant depreciating this library, or should we push forward?
I've just installed node_mailer, and trying to use it with a simple, local smtp connection served using python
$ python -m smtpd -n -c DebuggingServer localhost:1025
These are the options I call mailer.send with:
> config.email
{ host: 'localhost',
port: 1025,
domain: 'localhost',
from: '[email protected]',
authentication: 'login',
username: 'test',
password: 'test',
to: '[email protected]',
subject: 'MySubject',
body: 'MyBody' }
> mailer.send(config.email, function(err, resp) {console.log(err, resp);})
undefined
>
/home/akasha/workspace/status/playground/node_modules/mailer/node_modules/nodemailer/lib/smtp.js:572
if(data.match(/PIPELINING/i)){
^
TypeError: Cannot call method 'match' of null
at SMTPClient.<anonymous> (/home/akasha/workspace/status/playground/node_modules/mailer/node_modules/nodemailer/lib/smtp.js:572:17)
at Object.callback (native)
at SMTPClient._dataListener (/home/akasha/workspace/status/playground/node_modules/mailer/node_modules/nodemailer/lib/smtp.js:466:20)
at SMTPClient.<anonymous> (/home/akasha/workspace/status/playground/node_modules/mailer/node_modules/nodemailer/lib/smtp.js:642:14)
at Socket.<anonymous> (native)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:347:14)
What do I miss in this setup?
version 0.2.0 won't really work with any type of concurrent email setup. calling email.send multiple times in a row will cause a stream error.
this issue is now fixed in version 0.3.0. http://github.com/Marak/node_mailer/tree/0.3.0
will merge into the master branch and release soon.
starting on line 59 of node_mailer.js, it seems that the callbacks for handling close and empty have been copy/pasted from the addClient method and those two methods use different names for the hostClients/hostpool variables so the callbacks fail in the send method.
It would be cool if you could add attachments, but that seems like a lot of work. What about making it so you can specify a custom content type and if it is set then node_mailer doesn't add all that stuff in itself, so I could format the body myself but let this library handle all the details of sending the emails...
Hi,
I am trying to send Html in an Email through the following source code:
var email = require("./mailer/lib/node_mailer");
email.send({
host : "smtp.xyz.com", // smtp server hostname
port : "25", // smtp server port
ssl: false, // for SSL support - REQUIRES NODE v0.3.x OR HIGHER
domain : "xyz.com", // domain used by client to identify itself to server
to : "[email protected]",
from : "[email protected]",
subject : "Hello World",
body: "
Hello! This is a test of the node_mailer.
On executing the script, i get the following error message:
Object true has no method 'replace'
at Object.encodeQuotedPrintable (/home/devrelay/DeployedVersion/MailPrototype/mailer/node_modules/nodemailer/node_modules/mimelib-noiconv/mime-functions.js:151:15)
at EmailMessage.generateBody (/home/devrelay/DeployedVersion/MailPrototype/mailer/node_modules/nodemailer/lib/mail.js:336:27)
at SMTPClient._flushMessages (/home/devrelay/DeployedVersion/MailPrototype/mailer/node_modules/nodemailer/lib/smtp.js:157:21)
at SMTPClient.sendMail (/home/devrelay/DeployedVersion/MailPrototype/mailer/node_modules/nodemailer/lib/smtp.js:254:46)
at SMTPClientPool.send (/home/devrelay/DeployedVersion/MailPrototype/mailer/lib/node_mailer.js:71:10)
at dispatchMail (/home/devrelay/DeployedVersion/MailPrototype/mailer/lib/node_mailer.js:112:12)
at Object.node_mail as send
at Object. (/home/devrelay/DeployedVersion/MailPrototype/mailsender.js:3:11)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
How do i solve this ?
Thanks
Hi,
I'm using node-mailer 0.4.1 via npm
With some message bodies I'm getting this error in lineWrap()
TypeError: Cannot read property 'input' of null
at Object.lineWrap (/usr/local/lib/node/.npm/mailer/0.4.1/package/lib/node_mailer.js:191:175)
at Object. (/usr/local/lib/node/.npm/mailer/0.4.1/package/lib/node_mailer.js:166:28)
at Object.send (/usr/local/lib/node/.npm/mailer/0.4.1/package/lib/node_mailer.js:230:12)
at Object.sendEmail (../lib/email.js:100:16)
If I comment out line 166 I'm good to go. I'd help patch this but that lineWrap code is pretty mystical.
Thanks
-- James
It would be nice if this library presented a way to accept a reply-to header value.
Hello.
You have bug: you cache send command callback.
If I'll do:
function s(callback) {
email.send({to:..., .... }, callback);
}
s(function () { util.puts("a") });
s(function () { util.puts("b") });
... then I'll get "a" twice because you cache callback to connection.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.