This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
class net.SMTPConnection
Ayhan Rashidov edited this page Oct 8, 2021
·
3 revisions
Class for sending $.net.Mail objects via SMTP connection.
- SAP Help
https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.net.SMTPConnection.html
- Module
https://github.com/SAP/xsk/tree/main/modules/api/api-xsjs/src/main/resources/xsk/net
- Sample usage:
var net = $.net
// Create email from JS Object.
var mail = new net.Mail({
sender: {address: "sender@sap.com"},
to: [{ name: "John Doe", address: "john.doe@sap.com"}, {name: "Jane Doe", address: "jane.doe@sap.com"}],
cc: [{address: "cc1@sap.com"}, {address: "cc2@sap.com"}],
bcc: [{ name: "Jonnie Doe", address: "jonnie.doe@sap.com"}],
subject: "subject",
subjectEncoding: "UTF-8",
parts: [ new net.Mail.Part({
type: net.Mail.Part.TYPE_TEXT,
text: "The body of the mail.",
contentType: "text/plain",
encoding: "UTF-8",
})]
});
// Set mail server configurations.
let mailConfig = {
"mail.user": "<your-user>",
"mail.password": "<your-password>",
"mail.transport.protocol": "smtps",
"mail.smtps.host": "<your-mail-provider-host>",
"mail.smtps.port": "465",
"mail.smtps.auth": "true"
};
var smtp = new net.SMTPConnection(mailConfig);
let returnValue = smtp.send(mail);
$.response.setBody(JSON.stringify(returnValue));
- Coverage
Methods | Return Type | Description | Status |
---|---|---|---|
close() | void | Mocked. The SMTP Connection is now automatically closed after calling the send method. | ✅ |
isClosed() | boolean | Mocked. The SMTP Connection is always closed. | ✅ |
send(Mail) | void | Accepts and sends the net.Mail class. | ✅ |
- Issues
- Unit Tests
- Integration Tests ❌
✅ - Feature implemented and working as supposed.
❌ - Feature not implemented yet.