Parsing an email to find a mailing address?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

I have a very interesting request. A customer receives orders via email.
The email contains the shipping address, shipping method, email address
and phone number. This information is not all together, nor is it in the
same format in each email as the emails come from different order
houses.

The customer wants me to scan the email and pull the information out so
that it can be used to import into their shipping software.

I've been able to copy the body of the email to the windows clipboard
and then into a string variable in VB. But now the hard part, finding
the shipping address.

Has anyone done something like this? How do I recognize a shipping
address in a page full of text?

Some of the different variations on the address are:

Name: Name
Address: 123 Nowhere St
City/State/Zip: Glendale, CA 90000

or

Name
123 Nowhere St
Glendale, CA 90000

or

Name
123 Nowhere St
Glendale, California
90000 USA

or

Name: Name
Address: 123 Nowhere St
City: Glendale
State: ca
Country: usa
Zip: 90000
 
Has anyone done something like this? How do I recognize a shipping
address in a page full of text?

Is the e-mail address passed through the e-mail header? Can you extract it
there?

If not, you can use regular expressions to parse the email address.
 
Back
Top