construct-mobile-smtp
v2.3.8
Published
Basic SMTP client for editing and sending email messages
Maintainers
Readme
Cordova SMTP Client
Basic SMTP client cordova plugin for editing and sending email messages.
Installation
Install iOS and/or Android platform
cordova platform add ios
cordova platform add androidInstall the plugin using any plugman compatible cli
$ cordova plugin add construct-mobile-smtpUsage
On Javascript, use code that is similar to the following.
let mailSettings = {
"smtp": "smtp-mail.domain.com",
"smtpUserName": "[email protected]",
"smtpPassword": "password",
"emailFrom": "[email protected]",
"emailTo": "[email protected]",
"emailCC": "[email protected]",
"emailBCC": "[email protected]",
"subject": "email subject",
"textBody": "write something within the body<b>Hello world?<img src=\"cid:image.png\"></b> of the email",
"priority": "normal"
"attachmentsName": ["image.png"],
"attachmentsRole": ["2"],
"attachmentsType": ["image/png"],
"attachmentsBase64": ["iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAARSURBVDhPYxgFo2AUQAEDAwADEAABuGyTOQAAAABJRU5ErkJggg=="]
};
let success = function(message) {
alert("OK")
}
let failure = function(message) {
alert("Error sending the email");
}
window.smtpClient.sendMail(mailSettings, success, failure);Attachments
priority: "low" or "normal" or "high"
The attachments has 4 array.
Name, Role, Type, Base64
attachmentsName: file name with extension
attachmentsRole: in string format "0" or "1" or "2"
"0" is normal attachment <br />
"1" attachment only available email (useful for pictures) in cid link (Content-ID header) e.g. <img src=\"cid:image.png\">
"2" attachment behave normal and available as cid link
attachmentsType: MIME type in string
attachmentsBase64: content in Base64 stringReturn type
Method result call failed or success callback function.
Copyright
The library was originally written by albernazf (cordova-smtp-client) and later modified by Nelson Medina Humberto (cordova-smtp-client).
On iOS it makes use of the skpsmtpmessage library, which was originally written by Ian Baird. A recent fork can be found on (skpsmtpmessage).
