Analytics


Google

Wednesday, July 15, 2015

Using MailApp.SendMail

I thought that you could only MailApp.SendMail api in Google Script with standard parameter for example:

MailApp.sendEmail(recipient, subject,body)

However, I just realize that you just need to use braces to use other advance parameters. For example to add cc, you can do the following.

function sendTestMail() 
 {
   var toList = "strovek@gmail.com"; 

   var ccList = "strovek2@outlook.com" 
   var subj = "Testing sendmail api"; 
   var bodyContent = "If you receive this mail, then the test is successful"
      + "<br><br>This is a second line"; 

    MailApp.sendEmail({to: toList, cc: ccList, subject: subj, htmlBody: bodyContent});

No comments: