Page 1 of 1
Validate Email, not syntax
Posted: Thu Jan 13, 2005 9:01 pm
by Hibba
Alright, I need to check a list of emails to see if they are still valid. Is this possible? I have heard about MX records on a host, but it seems to just return True if the host is real. I want to check if '
user@host.com' is real or not.
Any suggestions?
Posted: Thu Jan 13, 2005 9:05 pm
by feyd
we've talked about this recently.. but here's a recap:
- MX can work, but a lot of hosts are starting to deny lookups entirely, due to spammers.
- sending an email is about the only semi-true way.. and even then, the server could have blackholing enabled. If you get a bounce, then you know it's an invalid, or disabled, or full email account.
Posted: Thu Jan 13, 2005 9:56 pm
by Hibba
Bah, that's what I figured. Ok, so I have no problem sending an email, and then take the emails that I get back and update from there. SO new question:
What is a good way to collect all the bounced back email addresses (in some type of delimited format, array, etc.)?
Thanks.
Posted: Fri Jan 14, 2005 9:49 am
by Hibba
anybody got a suggestion for this?
Posted: Fri Jan 14, 2005 2:26 pm
by JAM
You should be able to read the headers of the returning data as described in the RFC('s). Example;
Code: Select all
R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
S: HELO MIT-MC.ARPA
R: 250 SU-SCORE.ARPA
S: VRFY Crispin
R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
S: SEND FROM:<EAK@MIT-MC.ARPA>
R: 250 OK
S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
R: 450 User not active now
S: RSET
R: 250 OK
S: MAIL FROM:<EAK@MIT-MC.ARPA>
R: 250 OK
S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
R: 250 OK
S: DATA
R: 354 Start mail input; end with <CRLF>.<CRLF>
S: Blah blah blah...
S: ...etc. etc. etc.
S: .
R: 250 OK
S: QUIT
R: 221 SU-SCORE.ARPA Service closing transmission channel
The R: XXX gives you a status of the sendt action, so... By scanning the returned mails for the particular error codes, you should be able to find what you need.
Goodle for rfc mail errors or similiar for more info.
Edit: Note, that I'm not sure this is the way to do it. Havn't dealt with it myself, but it felt like an interesting idea.
Posted: Sat Jan 15, 2005 12:20 am
by Hibba
Sorry, but that info does not make any sense to me.