MyChat Scripts: mSendEmail, sending a letter via email (simplified variant)
Sending a letter via email. There are no checks, the function works in asynchronous mode and does not slow down the script. A letter in HTML format or as plain text. You can also attach files.
The main difference from the SendEmail function is SMTP server, which settings are specified on MyChat Server, so you don't have to set host, port, login/password, SSL settings, etc.
Syntax
procedure mSendEmail(sToList, sSubject: string; sMessageText: string; iMsgStyle: integer; sAttachedFiles: string);
Parameters and return values
Parameter |
Type |
Value |
sToList |
string |
list of recipient addresses, separated by commas; |
sSubject |
string |
letter title, text string; |
sMessageText |
string |
letter text; |
iMsgStyle |
integer |
letter type: 0 plain text, 1 HTML; |
sAttachedFiles |
string |
list of attached files, separated by the vertical line ("|" symbol). If there are no files, then specify an empty string. |
You should notice, that this procedure does not return any values, so it's impossible to know whether it was a successful execution or not. Also, sending works instantly in asynchronous mode with no pauses and stops.
Example
begin
mSendEmail('john@mycompany.com,helen@hilton.com, emma@spicegirls.net', // Recipient emails list
'Test message from MSL, SendEmail function', // Email subject
'My best friend gave me the best advice,' + CRLF + // Letter text body
'He said each day''s a gift and not a given right.' + CRLF +
'Leave no stone unturned, leave your fears behind...' + CRLF +
'And try to take the path less traveled by.' + CRLF +
'That first step you take is the longest stride.' + CRLF + CRLF +
'<i><b>If Today Was Your Last Day</b></i> (Nickelback)',
1, // Letter format. 0 - plain text, 1 - HTML
'C:\MyFolder\cover1.jpg|' + // Attached files list (optional), separated by "|" symbol
'C:\Users\Toshiba\Pictures\postmessagefrommsl.png');
end.
Script work result
[14:31:04] (Run "mSendEmail"): Script operation time: 3 ms
[14:31:04] (Run "mSendEmail"): Script done successfully.