The Script I'm trying to set up uses the MailApp service to send emails to recipients included in a Ghseet.

function sendProcessingEmail() {   var customerId = AdsApp.currentAccount().getCustomerId();   if (config.emailEachRun && config.emailRecipients &&       config.emailRecipients.length) {     MailApp.sendEmail(         config.emailRecipients.join(','),         customerId + ': Link Checker: Checking is ongoing',         'Link checking is still running on account: ' + customerId +             '. For more details see the spreadsheet: ' +             CONFIG_SPREADSHEET_URL);     setDateAsNow('dateEmailed'); 

I have noticed that the Script works fine for emails made out of a combination of numbers and letters but fails to send an email when the address contains other characters. Was wondering if anyone knows a workaround for this? Many thanks in advance.

Tag:google-ads-api, javascript, google-apps-script

Only one comment.

  1. Дмитро Булах

    There's no problem sending emails to recipients with special characters in the email address. This example works fine:

    function main () { MailApp.sendEmail('postman42+some-other@gmail.com', 'test message', 'this works') }

    However, the script fill fail if one of the emails is not a valid email, like mail1@example.com,-,mail2@example.com. Consider filtering your config.emailRecipients for matching an email pattern before joining. A number of possible regular expressions for filtering could be found here

Add a new comment.