Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Message $Messages.New(to: string, subject: string, body: string)

Example

...

Code Block
languagejs
var msg = $Messages.New( 'user@host.com' , 'remember' , 'Remember the milk!.' );
msg.Send();

Example

...

Code Block
languagets
var msg = $Messages.New();
msg.Subject = $Xml.Evaluate('Dispatch/Subject');
msg.Body = $Xml.Evaluate('Dispatch/Body');
msg.DeleteAfter = $Calendar.AddDays($Calendar.Today,30);
 
$Xml.SelectAll("To/Address", function(adr) {
     
    var type = adr.Evaluate('Type/Code');
     
    if (type === 'To') {
        msg.To(adr.Evaluate('EMailAddress'));
    } else if (type === 'CC') {
        msg.CC(adr.Evaluate('EMailAddress'));
    } else if (type === 'BCC') {
        msg.BCC(adr.Evaluate('EMailAddress'));
    }
     
});
 
$Xml.SelectAll("Attachments/Attachment", function(att) {
    msg.AttachFile(att.Evaluate('File'));
});
msg.Send();

...

Arguments

string to
message to recipients in email format. Optional but you must set a recipient before sending.
string subject
subject of message. Optional.
string body
body of message. Optional.

Remarks

This method does not send message, only prepares the message. To send message please use Message.Send method.

Example

Send a message

Code Block
languagejs
var msg = $Messages.New( 'user@host.com' , 'remember' , 'Remember the milk!.' );
msg.Send();

Example

Multiple Recipients

Code Block
languagets
var msg = $Messages.New();
msg.Subject = $Xml.Evaluate('Dispatch/Subject');
msg.Body = $Xml.Evaluate('Dispatch/Body');
msg.DeleteAfter = $Calendar.AddDays($Calendar.Today,30);


$Xml.SelectAll("To/Address", function(adr) {
     
    var type = adr.Evaluate('Type/Code');
     
    if (type === 'To') {
        msg.To(adr.Evaluate('EMailAddress'));
    } else if (type === 'CC') {
        msg.CC(adr.Evaluate('EMailAddress'));
    } else if (type === 'BCC') {
        msg.BCC(adr.Evaluate('EMailAddress'));
    }
     
});


$Xml.SelectAll("Attachments/Attachment", function(att) {
    msg.AttachFile(att.Evaluate('File'));
});
msg.Send();