new SMTPConnection()
Example
var subscribers = ["mike@sap.com", "daniel@sap.com", "john@sap.com"];
var smtpConnection = new $.net.SMTPConnection();
var mail = new $.net.Mail({ sender: "manager@sap.com",
subject: "Promotion Notice",
subjectEncoding: "UTF-8",
parts: [new $.net.Mail.Part({
type: $.net.Mail.Part.TYPE_TEXT,
contentType: "text/html",
encoding: "UTF-8"
})]
});
for (var i = 0; i < subscribers.length; ++i) {
mail.to = subscribers[i];
mail.parts[0].text = "Dear " + subscribers[i].split("@")[0] + ", you have been promoted to expert developer. Congratulations!";
smtpConnection.send(mail);
}
smtpConnection.close();
Methods
-
close()
-
Closes the SMTP connection
-
isClosed() → {boolean}
-
Checks if the connection is already closed
Returns:
- Type
- boolean
-
send(Mail) → {object}
-
Sends email(s)
Parameters:
Name Type Description Mail
$.net.Mail object, which will be sent through the open connection. - See:
Throws:
Throws an error if the parameter is not valid or the sending fails.Returns:
The object contains two properties: 'messageId' and 'finalReply'. The property 'messageId' contains the generated messageId and the property 'finalReply' contains the last reply from the mail server.- Type
- object