partial.js logo
Latest version
v1.3.1 (RC2)

FrameworkMail


This class supports sending e-mails via SMTP protocol. FrameworkMail supports TLS. For more informations click on the example.


Example:

https://github.com/petersirka/partial.js/tree/master/examples/email-send


var mail = require('partial.js/mail');
var message = new mail.Message('subject', 'body');

// Set e-mail sender
message.from('my@email.com', 'Peter Sirka');

message.to('friend@email.com');
message.to('family@message.com');

message.send('smtp.yourserver.com');

Properties


message.body {String}message.subject {String}
message.body;
return String;

Body of e-mail. Body can be HTML.

message.subject;
return String;

Subject of e-mail.

Methods


message.attachment(filename, [name])message.bcc(address)message.cc(address)message.from(address, name)message.reply(address)message.send(smtp, [options], [callback])message.to(address)
message.attachment(filename, [name]);
return MailMessage;

Add a attachment.

message.bcc(address);
return MailMessage;

Add a BCC e-mail address.

message.cc(address);
return MailMessage;

Add a CC e-mail address.

message.from(address, name);
return MailMessage;

Set sender of mail.

message.reply(address);
return MailMessage;

Add a reply e-mail address.

message.send(smtp, [options], [callback]);
return MailMessage;

Send a message.

message.to(address);
return MailMessage;

Add a to e-mail address.

Events


mail.on('error', err, message)mail.on('sending', message)mail.on('success', message)
mail.on('error', function(err, message) {    // YOUR CODE HERE});

Error handling.

mail.on('sending', function(message) {    // YOUR CODE HERE});

Sending message.

mail.on('success', function(message) {    // YOUR CODE HERE});

Message was sent.