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?
Validate Email, not syntax
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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.
You should be able to read the headers of the returning data as described in the RFC('s). Example;
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.
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 channelGoodle 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.