Monday, February 26, 2024
rated 0 times [  128] [ 1]  / answers: 1 / hits: 16088  / 14 Years ago, sun, october 24, 2010, 12:00:00

I'm using the built-in api for scripting against Google Spreadsheets to send some booking confirmations, and currently my script breaks if someone has filled in an invalid email. I'd like it to just save some data to a list of guests that haven't been notified, and then proceed with looping through the bookings.

This is my current code (simplified):

// The variables email, subject and msg are populated.
// I've tested that using Browser.msgBox(), and the correct column values are
// found and used

// The script breaks here, if an incorrect email address has been filled in
MailApp.sendEmail(email, subject, msg)

According to the documentation the only two methods on the MailApp class are to send emails and check the daily quota - nothing about checking for valid email addresses - so I don't really know what criteria must be fulfilled for the class to accept the request, and thus can't write a validation routine.

More From » google-apps-script


Stay calm, catch and log the exception and carry on:

try {
// do stuff, including send email
MailApp.sendEmail(email, subject, msg)
} catch(e) {
Logger.log(Error with email ( + email + ). + e);

[#95194] Thursday, October 21, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 91
Total Questions: 94
Total Answers: 119

Location: Vanuatu
Member since Wed, Oct 14, 2020
3 Years ago