Libraries anvil comm sendMailEx

void sendMailEx(key1=value1, key2=value2, ..., keyN=valueN))
Extended send mail function supporting content types, characters sets etc.

Example:

 anvil.comm.sendMailEx(
   smtphost="smtp.company.com",
   from="frank@company.com",
   to="scott@company.com",
   to="mary@company.com",
   subject="Hello",
   content="<html><b>Hello, World</b></html>",
   content_type="text/html");
 

Attachment example:

 attachments = [];
 attachments[] = new anvil.io.File("/files/Image009.jpg");
 attachments[] = new anvil.io.File("/files/kela.doc");
 attachments[] = [content_type="text/html", charset="UTF-8", content="<html><b>Hello</b></html>"];
 attachments[] = [content_type="application/octet-stream", content=anvil.comm.readBinary("/bin/sleep")];
 anvil.comm.sendMailEx(
   from="frank@company.com",
   to="scott@company.com",
   subject="Some Attachments",
   content="Please find enclosed some attachments.",
   attachments=attachments)
 

Parameters smtphost -  SMTP host (default: "localhost")
from -  set "From" field (required)
to -  set "To" field or add the specified address(es) to the existing "To" field (required)
cc -  set "Cc" field or add the specified address(es) to the existing "Cc" field (default: no Cc)
bcc -  set "Bcc" field or add the specified address(es) to the existing "Bcc" field (default: no Bcc)
subject -  set the "Subject" field. If the subject contains non US-ASCII characters, it will be encoded using the "charset" value (default: no Subject)
content -  set the main content of the message (default: no content)
charset -  set charset for main content and subject (default: "iso-8859-1")
content_type -  set the content-type for main content (default: "text/plain");
attachments -  array of Files or attachment data to be sent as attachments (default: no attachments). attachment data must have content and optionally content_type and charset