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 checks supported literal values, splits comma-separated addresses, and points to the malformed entry.
Before and after
The code before and after the fix.
function sendWeeklyReport() {
MailApp.sendEmail({
to: 'owner@example.com',
subject: 'Weekly report',
body: 'The report is ready.',
cc: 'ops@example.com, not-an-email',
});
}function sendWeeklyReport() {
MailApp.sendEmail({
to: 'owner@example.com',
subject: 'Weekly report',
body: 'The report is ready.',
cc: 'ops@example.com, editor@example.com',
});
}What myFunction does
- Points to the invalid entry inside the comma-separated recipient string.
- Marks only the malformed entry, not the valid addresses in the same field.
Check before you apply
- Choose the correct replacement address. myFunction does not guess recipients.
- myFunction checks literal values only. Addresses built at runtime are not checked, because their final text is not visible while you edit.
- Run the function in Apps Script and check the email that arrives.
Related reading