Merge pull request #2489 from STRML/mailAlias
Support 'alias' in mail transport config.
This commit is contained in:
commit
378aba60ae
|
@ -61,10 +61,11 @@ MailConnector.prototype.DataAccessObject = Mailer;
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* Email.setupTransport({
|
* Email.setupTransport({
|
||||||
* type: 'SMTP',
|
* type: "SMTP",
|
||||||
* host: "smtp.gmail.com", // hostname
|
* host: "smtp.gmail.com", // hostname
|
||||||
* secureConnection: true, // use SSL
|
* secureConnection: true, // use SSL
|
||||||
* port: 465, // port for secure SMTP
|
* port: 465, // port for secure SMTP
|
||||||
|
* alias: "gmail", // optional alias for use with 'transport' option when sending
|
||||||
* auth: {
|
* auth: {
|
||||||
* user: "gmail.user@gmail.com",
|
* user: "gmail.user@gmail.com",
|
||||||
* pass: "userpass"
|
* pass: "userpass"
|
||||||
|
@ -90,7 +91,7 @@ MailConnector.prototype.setupTransport = function(setting) {
|
||||||
transport = mailer.createTransport(transportModule(setting));
|
transport = mailer.createTransport(transportModule(setting));
|
||||||
}
|
}
|
||||||
|
|
||||||
connector.transportsIndex[setting.type] = transport;
|
connector.transportsIndex[setting.alias || setting.type] = transport;
|
||||||
connector.transports.push(transport);
|
connector.transports.push(transport);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,7 +130,8 @@ MailConnector.prototype.defaultTransport = function() {
|
||||||
* to: "bar@blurdybloop.com, baz@blurdybloop.com", // list of receivers
|
* to: "bar@blurdybloop.com, baz@blurdybloop.com", // list of receivers
|
||||||
* subject: "Hello ✔", // Subject line
|
* subject: "Hello ✔", // Subject line
|
||||||
* text: "Hello world ✔", // plaintext body
|
* text: "Hello world ✔", // plaintext body
|
||||||
* html: "<b>Hello world ✔</b>" // html body
|
* html: "<b>Hello world ✔</b>", // html body
|
||||||
|
* transport: "gmail", // See 'alias' option above in setupTransport
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* See https://github.com/andris9/Nodemailer for other supported options.
|
* See https://github.com/andris9/Nodemailer for other supported options.
|
||||||
|
|
|
@ -38,6 +38,14 @@ describe('Email connector', function() {
|
||||||
assert(connector.transportForName('smtp'));
|
assert(connector.transportForName('smtp'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set up a aliased transport for SMTP' , function() {
|
||||||
|
var connector = new MailConnector({transport:
|
||||||
|
{type: 'smtp', service: 'ses-us-east-1', alias: 'ses-smtp'}
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(connector.transportForName('ses-smtp'));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Email and SMTP', function() {
|
describe('Email and SMTP', function() {
|
||||||
|
|
Loading…
Reference in New Issue