Skip to content

Commit 45cf93c

Browse files
committed
Add error logging for SMTP sender.
1 parent ad4ecd3 commit 45cf93c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

mail.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* @module FrameworkMail
24-
* @version 2.5.0
24+
* @version 2.6.0
2525
*/
2626

2727
'use strict';
@@ -469,6 +469,13 @@ Mailer.prototype.send = function(smtp, options, messages, callback) {
469469
} else
470470
obj.socket = Net.createConnection(options.port, smtp);
471471

472+
if (!smtp) {
473+
var err = new Error('No SMTP server configuration. Mail message won\'t be sent.');
474+
callback && callback(err);
475+
F.error(err, 'mail-smtp');
476+
return self;
477+
}
478+
472479
obj.socket.$host = smtp;
473480
obj.host = smtp.substring(smtp.lastIndexOf('.', smtp.lastIndexOf('.') - 1) + 1);
474481
obj.socket.on('error', function(err) {

0 commit comments

Comments
 (0)