Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > extracting email addresses


Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-12-2003, 09:35 AM
radams
Guest
 
Posts: n/a
Default extracting email addresses


i have a couple thousand emails that have been returned to my inbox as undeliverable. i need to extract the email address that is in the body of the returned email and then send it to an access database. i've done all of this except extracting the email address. i have the body assigned to the string 'emailbody'. but how do i create a substring that contains the email address? any help would be great.
  #2  
Old 03-12-2003, 09:39 AM
Mikecrosoft's Avatar
Mikecrosoft Mikecrosoft is offline
Mexican Coder
 
Join Date: Jun 2002
Location: Monterrey, N.L., Mexico
Posts: 2,793
Default

if your emails are separated with commas, use the split function

strEmails = "A@B.com, C@D.Com, E@F.Com,...

Dim MyEmailsArr() as String
MyEmailsArr = Split(strEmails, ",")
__________________
Mikecrosoft.NET
* If I stop to ask I will stop to learn
* Just I know that I don't know nothing
  #3  
Old 03-12-2003, 09:55 AM
radams
Guest
 
Posts: n/a
Default

nope, there's just one email address per body, and it's always in some random location within the body string.
  #4  
Old 03-12-2003, 10:02 AM
Mikecrosoft's Avatar
Mikecrosoft Mikecrosoft is offline
Mexican Coder
 
Join Date: Jun 2002
Location: Monterrey, N.L., Mexico
Posts: 2,793
Default

Well then you need to locate the @, then read to the previous space, and then to the next space

example:
this is your body:

Hello my friend this is my email: mike_crosoft@hotmail.com


in the 46 place is the @, then loop througth the body starts on the 46 place to back until the space (mike_crosoft@), then loop throught the body until the next space (@hotmail.com).

i hope make sense
__________________
Mikecrosoft.NET
* If I stop to ask I will stop to learn
* Just I know that I don't know nothing
  #5  
Old 03-12-2003, 10:03 AM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

Well, if there is a space before and after the address, you could "hunt" for an @ and then get everything before and after it until you hit the space?

Edit: Works for me
  #6  
Old 03-12-2003, 10:12 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,887
Default

Quote:
Originally Posted by radams
i have a couple thousand emails that have been returned to my inbox as undeliverable. i need to extract the email address that is in the body of the returned email and then send it to an access database. i've done all of this except extracting the email address. i have the body assigned to the string 'emailbody'. but how do i create a substring that contains the email address? any help would be great.
We don't like spammers/mass mailers.
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing Email addresses from a text file Robert_Neville Word, PowerPoint, Outlook, and Other Office Products 1 03-02-2003 02:25 PM
Why are @hotmail.com email addresses not allowed? JimbotheGreat Tech Discussions 4 11-20-2002 05:17 PM
Checking Email Addresses Exist before sending them davie General 4 06-13-2002 06:22 AM
Linking MS Access to MS Exchange - Email addresses SJP7 Word, PowerPoint, Outlook, and Other Office Products 1 09-04-2001 05:30 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->