dw.net.MailNote: when this class is used with sensitive data, be careful in persisting sensitive information to disk.
The following example script sends an email with MimeEncodedText content:
function sendMail() {
var template: Template = new dw.util.Template("myTemplate.isml");
var o: Map = new dw.util.HashMap();
o.put("customer","customer");
o.put("product","product");
var content: MimeEncodedText = template.render(o);
var mail: Mail = new dw.net.Mail();
mail.addTo("to@example.org");
mail.setFrom("from@example.org");
mail.setSubject("Example Email");
mail.setContent(content);
mail.send();//returns either Status.ERROR or Status.OK, mail might not be sent yet, when this method returns
}
See Sending email via scripts or hooks in the documentation for additional examples.
bcc address List.cc address List.from address for the
email.subject of the email.to address List where the email is sent.subject of the email.subject for the email.bcc List. Address must conform to the RFC822 standard.bcc address List.
cc List. The address must conform to RFC822 standard.cc address List.
to address List. The address must conform to the RFC822 standard.to address List.
bcc address List.bcc address List or empty List if no bcc addresses are set.
cc address List.cc address List or empty List if no cc addresses are set.
from address for the
email.from address for this mail or null if no from address is set yet.
subject of the email.subject or null if no subject is set yet.
to address List where the email is sent.to address List or empty List if no to addresses are set.
from, content, and subject are empty an IllegalArgumentException is raised. An IllegalArgumentException is raised if neither to, cc nor bcc are set.
bcc address List. If there
are already bcc addresses they are overwritten.cc address List where the email is sent. If there are
already cc addresses set, they are overwritten. The address(es) must
conform to the RFC822 standard.subject for the email. If the subject is not set
or set to null at the time send() is invoked and
IllegalArgumentException is thrown.subject of the mail to send.
to address List where the email is sent. If there are
already to addresses, they are overwritten.