Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email validation on a batch email application

Status
Not open for further replies.

hawkieboy

Programmer
Apr 30, 2002
49
GB
Hi

I have an application that scans a table populated with email addresses it all works fine but the occansional error comes up because of an invalid email address('error in fox') also, some emails do not get sent once they have been placed in outlooks outbox because of the email address. The validation i am using is :

Code:
IF AT(" ", ALLTRIM(SENDTO.EMAIL)) > 0 OR ;
  AT("#", ALLTRIM(SENDTO.EMAIL)) > 0 OR ;
  AT("/",EMAIL) > 0 OR ;
  AT(";",EMAIL) > 0 OR ;
  AT(",",EMAIL) > 0 OR ;
  AT(":",EMAIL) > 0 OR ;
  AT("..",EMAIL) > 0 OR ;
  SUBSTR(SENDTO.EMAIL, LNLEN, 1) = "." OR ;
  AT("@",EMAIL) = 0 OR ;
  AT("@",EMAIL, 2) > 0
  SCATTER TO laerrors
  INSERT INTO ERRORS FROM ARRAY laerrors		
  DELETE
  LNCOUNT = LNCOUNT + 1
ENDIF

Could anyone tell be if there is anything i am not checking also, is it possible to check that the domain excists without actually sending the email. Some mentioned to me using PING but am not sure what this is.

Your help and advise is appreciated in advance

Many Thanks

Nick
 
Hi Nick,

You don't say how you are sending the email. If you are using Automation with Outlook, you should use the Resolve method. This is a method of a Recipient object. It returns .F. if the email address cannot be resolved. You can then call the Remove method to delete it.

Note that "Cannot be resolved" means that either the format of the email address is bad, or that it the recipient is a name, but it does not appear in the address book. It doesn't mean that the email address actually exists. There is no way of knowing that without actually sending the message.

Hope this helps.

Mike
Mike Lewis
Edinburgh, Scotland
 
Hi Mike,

I am sending the emails through automation. However i am fairly new to vfp, could you please explain how i would go about using the resolve/remove method

thanks for taking the time reply to my thread

Many Thanks your help and advice is appreciated in advance
 
thanks for the help Mike(both) your help and advice is appreciated in advance
 
Nick,

Assuming you have a mail message object called oMail, you could do something like this:

oRecip = oMail.Recipients.Add("mike@whatever.com")
IF NOT oRecip.Resolve
* bad e-mail address or contact name
oMail.Recipients.Remove ;
(oMail.Recipients.Count)
ENDIF

Mike
Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top