500) ) {
print '
';
print 'You must complete all sections of the postcard before we can send it, and you cannot enter more than 500 characters in your message.';
print '
';
} else {
$success = false;
$comma = strrpos($postcardData['recipientEmail'],',');
if($comma === false) { //no comma, sending to 1 recipient...
if(validEmail($postcardData['recipientEmail'])) {
sendPostCard($postcardData);
$success = true;
} else {
print '';
print 'Please provide a valid email address.';
print '
';
}
} else { //comma found, sending to more than 1 email...
$emails = explode(',',$postcardData['recipientEmail']);
if(count($emails) > 5) {
print '';
print 'Please provide a valid email address.';
print '
';
} else {
$errors = 0;
foreach($emails as $email) {
if(!validEmail(trim($email))) {
++$errors;
}
}
if($errors > 0) {
print '';
print 'Please double-check the email addresses (one or more were not valid).';
print '
';
} else {
foreach($emails as $email) {
$postcardData['recipientEmail'] = $email;
sendPostCard($postcardData);
}
$success = true;
}
}
}
if($success) {
delayedReload('Your postcard has been sent...',__HOME_URL__,1500,1);
}
}
}
print displayPostcard('form',$postcardData);
print postcardFooter();
?>