views:

166

answers:

3

Is there a way to determine pop or imap server given the email address? I am building an application for non technical users and I dont really want to bother them with asking their imap/pop servers. mail2web.com does this, but I am not sure how.

A: 

Thunderbird 3 does it too.. I'd take a look at the source code.
I think it's just a lookup table though..

Joril
A: 

There is nothing in a standard that dictates a POP/IMAP server for a given domain. Only convention or, as Joril suggests, lookup tables can be used. SMTP servers are different as there is a functional requirement to send the mail onto the next stop. Pick up (via POP/IMAP) is an entirely local domain admin issue. Sorry.

I guess you could take the domain and build a server name such that [email protected] becomes pop.mymail.com and imap.mymail.com. Or perhaps take it further and interrogate the MX records and perform similar substitutions. Then you could run through your list of candidate servers looking for a POP/IMAP response. Might be a bit dodgy on the security front though.

Cheers, Dan

Dan Kendall
A: 

There's absolutely no way to do this correctly in general.

However, you can use tables of common mail providers to fill in defaults, and you could fill in smtp.example.com etc... but that will still fail in some simple cases, though, like my work system where everything is on mail.wherever.com on unusual port numbers. So in the end, the user must be able to override whatever you do.

If you really want it to be general, you're going to have to deal with certificates and EAP as well.

Andrew McGregor