Google Script email also being sent to account owner? - email

I have a problem with a Google MCC Script I have. It's set up to run every day in the early hours of the morning, do some processing, and email out a result, using Google Scripts' built in MailApp.sendEmail function.
The problem is that, while the email is sent successfully, I'm also recieving messages in the inbox of the email address which owns the MCC account along the lines of
Delivery to the following recipient failed permanently:
MCC_account#example.com
Technical details of permanent failure: The email account that you
tried to reach does not exist. Please try double-checking the
recipient's email address for typos or unnecessary spaces.
with the 'Original Message' appended below that indicating it is indeed the message the Script has sent. Here's my code:
function main() {
var accountSelector = MccApp.accounts();
var accountIterator = accountSelector.withIds('###-###-###').get();
if(accountIterator.hasNext()){
var account = accountIterator.next();
MccApp.select(account);
var data = getData();
sendEmail(data);
} else Logger.log("Error: no accounts found");
}
function sendEmail(data){
var name = 'name';
var bodytext = 'body';
MailApp.sendEmail({
to: 'receiver-inbox#example.com',
name: 'Google Adwords Scripts',
replyTo: 'do-not-reply#example.com',
subject: 'SUBJECT',
attachments: [{fileName: name, mimeType: 'text/csv', content: data}],
body: bodytext
});
}
So, to clarify, the MCC account is owned by one email address, the script doesn't reference that at all, but I'm recieving the email not only in the target mailbox but also a failed delivery message in the owner inbox.
Can anyone shed any light on what is happening here?

It is very likely that you are running another copy of the script that is sending these emails. Go to your Google Account settings here and revoke access to the other script.
If you have multiple Google accounts, do a scan for all the accounts.

Okay, apparently this is a known issue with AdWords Scripts:
https://groups.google.com/forum/#!topic/adwords-scripts/SJtNW_wuArI

Related

Emails generated by Googleappscript are skipping my inbox

I have a shared google sheet that when someone enters their info it prompts the next individual with an email that's automatically generated by the script. These emails prompt a dozen individuals and show up as coming from my email. This has functioned perfectly for months.
In the past week or so I've stopped emails have stopped coming to my inbox. The still shows up in "Sent" and also under "All Mail" but I'm not sure if that's just the "sent" message". All other users receive emails normally. Also, if I change my target address to a different email it works fine. Basically, it appears i can't send myself an email.
I have recently started using email filters which I know is the most likely culprit in these situations. None of them currently use the "Skip Inbox" function.
I have no idea why these emails don't show up for me despite working for everyone else as well as if I enter an alternate email address.
Edit #1:
Below is the section of code that emails the next person. As stated it appears to be working perfectly because everyone else except myself gets an email. Also if I change my email to an alternate email that works as well. It appears the issue is solely when the script emails myself from the same email address.
Also, I noted that I was previously receiving emails. This may have been untrue. As a testing measure I previously "CC'd" myself with every email that went out so that I could track that the system was working well. You'll note in the code that my email address is stored in the variable "emailAddress2" and that the CC line has now been commented out. I may not have been receiving the actual email sent to myself before but actually only receiving the CC'd version.
Here's the code:
function emailNext (JustPickedName, NextToPickName, SelectedDate) {
// Function Sends emails to the next Person in the list
Logger.log("Into Email Next");
//Set all the Email characteristics
SelectedDate = Utilities.formatDate(new Date(SelectedDate), "GMT", "EEE, MMM d, yyyy"); //Format the Date for inclusion in the email
var StaffMember = StaffList.find(StaffList => StaffList.Name === NextToPickName);//Find Emails address by finding name in Emails Object
var subject = ' You have a pick pending in the ' + ActiveWeekSheetName + ' sheet';
var message =
'<p>Dear Dr. ' + NextToPickName + '</p>' +
'<p>You have a pick pending on ' + SelectedDate + '. Please look at the ' + ActiveWeekSheetName + ' sheet.</p> <p> Dr. ' + JustPickedName + ' has just made a pick and you are up.</p>' +
'<p>You can make your selection here: GGH Room Selection</p>';
MailApp.sendEmail({
to: StaffMember.Email,
//bcc: emailAddress2,
name: 'PickListBot',
subject: subject,
htmlBody: message})
Logger.log("StaffMember.Email: " + StaffMember.Email);
}
What you are describing might in fact be a bug.
Since this is the case, I suggest you check this issue here on Google's Issue Tracker and star it in order to get any updates with regards to it.

Apps script does not send email containing links to Google Drive files on a given G Suite domain, no error message

Context
We are currently working on a short Apps script that sends links to Google Drive files (shared with anyone with the link) through the MailApp.sendEmail(options) function.
The script works well on our test G Suite domain but on the production domain, it just does not send the emails. There are no error messages.
Some code
The issue can be reproduced through the following pieces of code:
Code.gs file
function test_sendEmail() {
const template = HtmlService.createTemplateFromFile('template.html');
template.link = "https://drive.google.com";
template.title = "This is a link";
const mailBody = template.evaluate().getContent();
console.log("Quota: " + MailApp.getRemainingDailyQuota()); /* Quota is not exceeded. */
try {
const options = {
to: "myEmail#Address.com", /* Replace this with your email address */
subject: "LINK",
htmlBody: mailBody,
noReply: true
};
MailApp.sendEmail(options);
} catch(e) {
console.log(e.message);
}
}
template.html file
Link: <a href='<?= link ?>'><?= title ?></a>
What we tried
Emails are properly sent when the link does not contain the drive.google.com part. For example, emails with links to google.com are sent properly.
We are able to send an email from the Gmail account the script is executed as and this email is sent properly with the Drive links.
As opposite as this question, I do not get "Message blocked" email and using GmailApp.sendEmail instead of MailApp.sendEmail does not seem to change anything.
Finally, the script above works well in the test G Suite domains and in some others we tried.
Thus, I believe that it comes from the G Suite domain configuration that have specific restrictions on Apps script. Is it possible? Where can I change it in the G Suite admin console? What other points should I check to make it work?
More details on the issue:
The script fail to send email both with G Suite, gmail and other
email addresses.
We tried in both Apps script runtime (V8 and legacy). Both doesn't
work properly.
I believe that SPF/DKIM/DMARC are not setup in the domain.
We use the same test recipients in both G Suite environments.
The code after the sendEmail method call is executed properly.
The provided template was just an example to reproduce the issue.
The real template looks like a typical email, with a list of links. It is not link-only.
In the future, the script is supposed to send less than 100 emails per day. Right now, it is just sending a few test emails (not more than in test environment).
We use the default cloud project associated with the script.
The script is bound to a Google Sheets file.
Below is the real template that we use.
Dear Customers,<br/><br/>
We inform you that new documents are available. Please find them below:
<ul>
<? for(let i = 0; i < docs.length; i++) { ?>
<li>Document <a href='<?= docs[i].link ?>'><?= docs[i].title ?></a>, <i><?= docs[i].documentType ?></i> is available</li>
<? } ?>
</ul>
<br/>
Regards,<br/>
Your customer service.
Instead of MailApp use GmailApp (you might have to change the sendEmail parameters, check the docs)
The above because others have being reported similar problems, actually something similar happened recently to me while working on client's project.
Related
MailApp.sendEmail method doesn't get through to accounts with URL in the body - Message Blocked

ccing using SendGrid Service in Bluemix

Trying to use SendGrid Service in Bluemix coding in Node.js. I use the addCc() method to add an address to cc to. I get no error msg and the mail is delivered to the main address, but nothing gets sent to the cc:ed address. And if I look ath the top of the mail going to the main recipient I can see the cc address there. Does anyone know if there is a bug or limitation in using cc with SendGrid?
Best Regards
W
A common error is to pass an array to the addCc() function when it expects a string. Using v2.0.0 of the 'sendgrid' npm module, the code below will correctly send an email which cc's 'jennifer#electric.co'.
As mentioned in the comment above, verify that you're not hitting issue https://github.com/sendgrid/sendgrid-nodejs/issues/162
// Pre-req: get the SendGrid credentials for username and password
// from VCAP_SERVICES into the 'user' and 'pass' vars
var sendgrid = require('sendgrid')(user, pass);
var email = new sendgrid.Email({
to: 'fargo.north#electric.co',
from: 'bronco.bruce#electric.co',
subject: 'SendGrid Test',
text: 'This is a SendGrid test'
};
// add a cc address as a single string
email.addCc('jennifer#electric.co');
sendgrid.send(email, function(err, json) {
if (err) {
return console.error(err);
}
console.log(json);
}

How to monitor delivery of emails sent by salesforce by source code?

I have following questions. Assuming I have following code
public class MessageMaker {
public static void helloMessage() {
System.debug( 'Entry point' );
Case c = new Case();
insert c;
EmailMessage e = new EmailMessage();
System.debug( 'EmailMessage created' );
e.parentid = c.id;
// Set to draft status.
// This status is required
// for sendEmailMessage().
e.Status = '5';
e.TextBody =
'Sample email message.';
e.Subject = 'Apex sample';
e.ToAddress = 'my#mail.com';
insert e;
List<Messaging.SendEmailResult>
results =
Messaging.sendEmailMessage(new ID[]
{ e.id });
System.debug(results.size());
System.debug(results[0].success);
System.debug(results[0].getErrors().size());
System.assertEquals(1, results.size());
System.assertEquals(true, results[0].success);
}
}
1.First question. I want to find out using apex code if the message was really delivered.
Here documentation says http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sendemail_emailresult.htm
Even if success = true, it does not mean the intended recipients received the email, as it could have bounced or been blocked by a spam blocker. Also, even if the email is successfully accepted for delivery by the message transfer agent, there can still be errors in the error array related to individual addresses within the email.
So I have been trying to send email by apex code and look for results[0].success. It seems it says like it is described in documentation, so success is true even though email address was incorrect.
Also I have tried to check this manually through email logs http://eu2.salesforce.com/help/doc/en/email_logs.htm
And I have found following row in resulting log regarding my email sent to incorrect address
9/2/2013 9:36 66/FC-09306-20B54225 T julfy#i.ia
julfy=i.ua__0-6uvic1ltvun1nf#95mngihd2hpe0w.b-ysubea0.bl.bnc.salesforce.com 1434 005b0000000J7bm
<_0vTJ000000000000000000000000000000000000000000000MSHRSY00W1-CKg3DShWC5xu24ccHFA#sfdc.net>
1 311.627583 421 4.4.0 [internal] no MXs for this domain could be
reached at this time
But I don't know how to access this information by apex code. Any thoughts?
Second question. If message was delivered and recipient forwarded it, is any possibility to monitor that using apex code? Anybody?
You can't do either of those things. APEX runs on Salesforce's servers and when you send an email it leaves that environment. The only time you can monitor a successful response is when you're dealing with an API that generates webhooks.

check if email are valid and exists

I am working on a web app that requires me to check if the users email are valid and exists. (I do the regex check) The question is what is best practice of verifying that an email exists?
Here are some options that I have though about:
send an email to the user and make them confirm the email address
do a VRFY SMTP - is this still used? should i bother looking into it?
any other good idea?
sending a verification email to the user verifies that the email is valid and that the user is the owner of the account
Doing a regex check on an email address can be frustrating for some users, depending upon the regex. In my case, I have several domains where all of the addresses are delivered to a single mailbox, so I can use the address to specify the sender (for filtering). Here are some valid (per RFC 2822) address patterns that I have had rejected by various websites:
foo#example.name
foo#example.info
foo+sitename#example.org
foo-sitename#example.com
I recommend that you skip your regex test and just send the verification email with a confirmation link -- anything else will leave your application brittle and subject to breakage as soon as someone comes up with a new DNS or SMTP extension.
PS: ICANN is expected to approve UNICODE domain names Real Soon Now. That will play merry hell with Regex patterns for email addresses.
Not an answer to your question, but I'd like to quote someone on reddit:
Validating an email address using nothing but a regular expression is like building a house using nothing but a power drill.
This is the only RFC-valid way to do it:
[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\ xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\x ff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015 "]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\ xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80 -\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]* )*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\ \\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\ x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x8 0-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n \015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*)*#[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([ ^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\ \\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\ x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80- \xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015() ]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\ x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\04 0\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\ n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\ 015()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?! [^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\ ]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\ x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\01 5()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)<>#,;:". \\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff] )|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^ ()<>#,;:".\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\0 15()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][ ^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|"[^\\\x80-\xff\ n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>#,;:".\\\[\]\ x80-\xff\000-\010\012-\037]*)*<[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(? :(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80- \xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:#[\040\t]* (?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015 ()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015() ]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\0 40)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\ [^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\ xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]* )*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80 -\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x 80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t ]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\ \[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff]) *\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x 80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80 -\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015( )]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\ \x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*#[\040\t ]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\0 15()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015 ()]*)*\)[\040\t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^( \040)<>#,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]| \\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80 -\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015() ]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:". \\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff ])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\ \x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x 80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015 ()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\ \\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)?(?:[^ (\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000- \037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\ n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]| \([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\)) [^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff \n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\x ff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*( ?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\ 000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\ xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\x ff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*) *\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*#[\040\t]*(?:\([^\\\x80-\x ff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80- \xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*) *(?:[^(\040)<>#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\ ]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\] )[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80- \xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\x ff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*( ?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80 -\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)< >#,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>#,;:".\\\[\]\000-\037\x8 0-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?: \([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()] *(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*) *\)[\040\t]*)*)*>)
So let's not.
Sending them an e-mail forcing them to press a confirmation link is the best option, as there's always the chance that their SPAM filter will block your mails. It's best to get that dealt with when their paying attention.
In Perl there is a nice module called Email::Valid which can check the email address for valid formation, and optionally check the email address's domain for an MX record.
function EmailValidation($email)
{
$email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits
if ( eregi ( '[a-z||0-9]#[a-z||0-9].[a-z]', $email ) )
{ //checks to make sure the email address is in a valid format
$domain = explode( "#", $email ); //get the domain name
if ( #fsockopen ($domain[1],80,$errno,$errstr,3))
{
//if the connection can be established, the email address is probably valid
return true;
} else
{
return false; //if a connection cannot be established return false
}
return false; //if email address is an invalid format return false
}
}