Sending an email

if(layout.GetNumSheets())
{
  local file="c:/temp/document.pdf";
  if(layout.SaveAsPDF(file, {dialog=0,protection="RC4_40",
                imgMaxDPI=300,imgQuality=0.85, pswView="",pswEdit="",pswFlags=0}))
  {
      local mail={dialog=1,to="john@somecompany.com",subject="PDF File" };
      //mail.to+=";bill@somecompany.com"
      mail.file <- file;
      mail.body <- "Dear Customer\nPlease read attached document\n\nThank you,\npriPrinter Script";
      mail.dialog=0;
      SendMail(mail);
  }
}

All samples