Storing and Accessing email Addresses
- From: jecottrell65@xxxxxxxxx
- Date: 14 Aug 2006 08:47:08 -0700
Hello All,
As I continue to work on an email parsing and forwarding application my
next job is to save a list of email addresses that will receive a
forwarded copy of a parsed email. The addresses will need to persist if
the program is stopped (does that make sense... each time the program
is run, the addresses will need to be available.) I'll need to do some
validation on them when they're initially entered on the main form. And
I'll need to be able to cycle through them in a loop when I send them
to the smtp server. (The email that gets forwarded will have some data
archived from it in a database eventually, so I'm leaning torwards a
simple database to keep all this info....)
What is the best way to handle the addresses? Datatype? etc. To allow
for all these requirements? I'm going to start reading on databases in
VB right now, so maybe I'll have some basic understanding after a bit.
The other big question is how to handle the iteration through the
addresses when forwarding them. The problem as I see it is the Winsock
functionality is handled in a state machine. There is always a
possibility that an address will generate an error which will poop the
program flow out of the proper state and kill the loop that was
generating the recipients.
Here is the few states around where I'll be working:
Case MAIL_HELO
'Change current state of the session
m_State = MAIL_FROM
'Send MAIL FROM command to the server
Winsock1.SendData "MAIL FROM:" & "<test@xxxxxxxxxx>" &
vbCrLf
Debug.Print "MAIL FROM:" & "<test@xxxxxxxxxx>"
Case MAIL_FROM
'Change current state of the session
m_State = MAIL_RCPTTO
'Send RCPT TO command to the server
Winsock1.SendData "RCPT TO:" & "<test2@xxxxxxxxxx>" &
vbCrLf
Debug.Print "RCPT TO:" & "<test2@xxxxxxxxxx>"
Case MAIL_RCPTTO
'Change current state of the session
m_State = MAIL_DATA
'Send DATA command to the server
Winsock1.SendData "DATA" & vbCrLf
Debug.Print "DATA"
My natural approach using a C mentality would be to do something
similar to:
Case MAIL_HELO
'Change current state of the session
m_State = MAIL_FROM
'Send MAIL FROM command to the server
Winsock1.SendData "MAIL FROM:" & "<test@xxxxxxxxxx>" &
vbCrLf
Debug.Print "MAIL FROM:" & "<test@xxxxxxxxxx>"
Case MAIL_FROM
'Send RCPT TO command to the server
ADD LOOP HERE
Winsock1.SendData "RCPT TO:" & "<" &
strAddress[intIndex] & ">" & vbCrLf
Debug.Print "RCPT TO:" & strAddress[intIndex]
intIndex = intIndex + 1
END LOOP HERE
'Change current state of the session
m_State = MAIL_RCPTTO
Case MAIL_RCPTTO
'Change current state of the session
m_State = MAIL_DATA
'Send DATA command to the server
Winsock1.SendData "DATA" & vbCrLf
Debug.Print "DATA"
Also, my approach to the state machine/error dilemma would lead me (in
a C world) to set a flag when we start sending addresses to allow me to
get back into the loop from the error state. But I would imagine there
are better ways to do that in VB6.
So, there are my two latest questions a quick few pointers on which
direction to head in, start reading, etc. would be much appreciated.
John
.
- Follow-Ups:
- Re: Storing and Accessing email Addresses
- From: Geoff
- Re: Storing and Accessing email Addresses
- From: Steve Gerrard
- Re: Storing and Accessing email Addresses
- Prev by Date: Re: Permission Denied error
- Next by Date: Re: Printer.Object continued
- Previous by thread: Permission Denied error
- Next by thread: Re: Storing and Accessing email Addresses
- Index(es):
Relevant Pages
|