OzoneFriendly
asked on
How do I check for a valid email address before sending?
Hello experts;
I have an Access database with code that sends out emails, the pointy end of the code looks like;
Set objOutlookRecip = objOutlookMsg.Recipients.A dd(cliente mail)
objOutlookRecip.Type = olTo
objOutlookMsg.Send
The problem is sometimes people have entered invalid email addresses, and when it gets to the send line, the code breaks.
How do I check BEFORE sending that the email address is valid according to Outlook?
I have an Access database with code that sends out emails, the pointy end of the code looks like;
Set objOutlookRecip = objOutlookMsg.Recipients.A
objOutlookRecip.Type = olTo
objOutlookMsg.Send
The problem is sometimes people have entered invalid email addresses, and when it gets to the send line, the code breaks.
How do I check BEFORE sending that the email address is valid according to Outlook?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Mine wont, It will only process an email at a time.
If you add recipients one at a time, no, passing >1 address will not work. However, this will: objOutlookMsg.To = "addr1@foo.com;addr2@foo.c om;addr3@f oo.com"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Basically, you cannot check if an email address is valid, but you can check if it is proper in "form" e.g someone@domain.tld
1 either you connect to the email domain server and check
2. try sending the email, some servers will reject the email if the email is not balid (ie, does not exist)
To check for valid form, use regular expression
check here for example
http://www.vbforums.com/showthread.php?t=559741&highlight=valid+email+regex
1 either you connect to the email domain server and check
2. try sending the email, some servers will reject the email if the email is not balid (ie, does not exist)
To check for valid form, use regular expression
check here for example
http://www.vbforums.com/showthread.php?t=559741&highlight=valid+email+regex
ASKER
I will check out these options and see which one will work in my situation soon. Thanks for the advice.
ASKER
I really must get around to trying these solutions. I've been soooo busy. :-(
>> I really must get around to trying these solutions
As far as I see, all possible solutions are provided.
As far as I see, all possible solutions are provided.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
ASKER
Out of interest, would any of these validate as okay the following string;
email1@domain.com; email2@domain.com
I know some instances might be formatted like that, which Outlook WILL accept, but will that code?