I see that there is a mail plugin. This is how to send emails through Servoy right? An html email that can contain an attachment, such as a PDF.
- Code: Select all
Send a mail, if you make the msgText start with the message will be sent in html (and you can use all html formatting).
If you want to have a different reply address than from, you can specify this with the from parameter by adding another email after it.
var attachment = plugins.mail.createBinaryAttachment('embedded',plugins.file.readFile('c:/temp/a_logo.gif'));
var msgText = 'plain msg<html>styled html msg<img src="%%embedded%%"></html>';
var success = plugins.mail.sendMail('[email protected],[email protected]', 'John Cobb <[email protected]>', 'subject', msgText,null,'[email protected],[email protected]',attachment);
if (!success)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
@param {String} to A string containing 1 or multiple addresses separated by a comma.
@param {String} from A string containing an address and optional reply addresses, separated by commas.
@param {String} subject The subject of the mail
@param {String} msgText The message text
@param {String} cc One or more addresses separated by a comma
@param {String} bcc One or more addresses separated by a comma
@param {Attachment} attachment A single attachment
@return Boolean
QUESTIONS
1. If I understand correctly, we have to setup a Mail Server for the plugin to work right? After that is setup, sending emails out should work.
This is all fully supported within the new Servoy TiNG releases correct?
2. Also, how does Receiving emails work? Is that setup with the Mail Server as well? And user login can be used to see emails stored within the mail server?
- Code: Select all
plugins.mail.receiveMail(username, password, leaveMsgsOnServer, receiveMode, onlyReceiveMsgWithSentDate, properties)
3. Is there any way of tracking to see if an email has successfully been received by the recipient? I'm not sure if that's an email protocol even possible, was just curious.
HELP
I'm just trying to make sure I fully understand the process. To put it simply, I want users to be able to send out emails that have PDF attachments. Seems straight forward... but I want to make sure I catch any problems due to my assumptions.