Skip to content

Diagnostic reference

Invalid email recipient

How to find a malformed address in a MailApp recipient list in Google Apps Script and fix it before the script sends email.

Updated August 30, 2026

What myFunction reports

Invalid email address in cc: not-an-email

What it means

Apps Script types the cc field as a string, but not every string is a valid recipient list. myFunction inspects supported literal values, splits comma-delimited addresses, and points to the malformed entry.

Before and after

See the change before you make it.

Problem
function sendWeeklyReport() {
  MailApp.sendEmail({
    to: 'owner@example.com',
    subject: 'Weekly report',
    body: 'The report is ready.',
    cc: 'ops@example.com, not-an-email',
  });
}
Safer version
function sendWeeklyReport() {
  MailApp.sendEmail({
    to: 'owner@example.com',
    subject: 'Weekly report',
    body: 'The report is ready.',
    cc: 'ops@example.com, editor@example.com',
  });
}

What the assist changes

  • Points to the invalid entry inside the comma-separated recipient string.
  • Leaves valid addresses in the same field distinguishable from the malformed value.
  • Reports against literal values only, where the extension can verify the actual text.

What stays with you

  • Choose the correct replacement address; myFunction does not guess recipients.
  • Values assembled at runtime are left alone because their final recipients are not visible while editing.
  • Running the function and confirming the resulting email remain in Apps Script.