Checking an e-mailbox server sided?

software development

#1

Hi,

I wish to check a mail server for incomming message’s server sided so when a user registrates he can reply on a e-mail he’s is recieving to validate his e-mail adress and therefor validating his account…

any suggestions?.. php or cgi or any other kind of methode…


#2

Just to be sure, it seems you want your web site to check for an e-mail message. Usually this is done by having the mail server pass the message to a special script when it is received. I’m not aware if DreamHost will help you with that. Wouldn’t hurt to ask them directly.

Instead, you might want to try writing a web page script and link to it in the e-mail message to the user:

Hi! Thank you for registering! Please complete the registration process by visiting this link: http://www.yourdomain.com/confirmation.pl?user=xxx


#3

You can set up a special POP3 box for incoming emails, and have a script check that POP3 box on a regular basis using cron.

That’s not the solution I would recommend.

If you want to validate user@domain.com, send a message to user@domain.com containing the link

http://mydomain.com/validate.cgi?addr=user@domain.com&val=SOMETHING

How do you get SOMETHING?

$addr = ‘user@domain.com’;
$salt = ‘4q’;
$something = crypt($addr, $salt);

When you user clicks on the link, you simply run the crypt function on the addr in the URL and see if it matches the val in the URL. If it does, you’re in like Flynn.

This is not a very secure system. Someone can ask to validate several email addresses, and figure out what you are doing. That makes it possible to validate addresses that they don’t own.

Toss in a function that mangles the $addr, and a function that generates new $salt values every day (you would want to test against the last 21 days of $salt values, and warn people that the validation email expires in two weeks) and it starts being fairly safe to use.