Page 1 of 1

Mail function (Mailer Deamon)

Posted: Wed Aug 07, 2002 11:46 am
by Lancelot
I use a form on my site, the user can enter a mail-adress and then a mail is being send to that adress. I just use the function:
mail($to,$subject,$mail,$headers);
Now my problem is that when someone enters an invalid adress (like: qsdqsd@qsdqsd.com) a mailer deamon is being send to the host. My server admin has been complaining that he gets to many mailer deamons :) How can I prevent this, how can I let the mailer deamons being send to me and not to the server.
Putting "From: $from", "Return-To: $from", "Errors-To: $from" in the headers doesn't help. ($from is my email adress).

Does anyone knows a solution for this?

thx,
Lancelot
http://www.multiccianforce.tk

Posted: Thu Aug 08, 2002 7:59 am
by haagen
Hi there.

It's important that you have ONE newline after each headerelement.

Another way to do this is to use sendmail directly, invoke it with the "-f emailadress" then the bounced mail will got to that email.

Posted: Thu Aug 08, 2002 8:12 am
by llimllib
you could also check to make sure that your user has an mx record with the getmxrr() function before you send them an email. If you don't want to write your own script for this, check evilwalrus.com or hotscripts.com - there are plenty already out there.

Posted: Thu Aug 08, 2002 10:30 am
by PaTTeR
When you use mail() function on Unix server your outgoing e-mail ALWAYS have a header
'From: nobody@yourhost.com' (if httpd is run by nobody )

If you set 'From' header with mail() your recepient will see this header, but mailer deamon will use nobody@yourhost.com !!!


You can solve this with Mail class writen by
Chuck Hagenbuch <chuck@horde.org> . This PHP Class comes with PHP source code. iI have tested with sendmail and all is O.K. (but your admin myst add 'nobody' in sendmail trusted users list)