Page 1 of 1

[SOLVED] my problem with mail() function?

Posted: Tue Feb 01, 2005 12:48 pm
by alix
i have been working with two servers... i put the same script on both and it works fine on one but not the other.. this is the script that i've been using.

Code: Select all

$clean_message = trim(stripslashes($message));
mail("myemail@domain.com", "$subject", "$clean_message",
     "From: website");


I get the email every time, but when i try that on my other server, i get nothing. yet, i have another script that i didnt write mail correctly.. i cant figure that script out though to see how it does it. i've been studying the php manual for this as well, all the header stuff consuses me. Any help would be great.. thanks

Posted: Tue Feb 01, 2005 2:00 pm
by johndoe132
Alix,
Have you compared the php.ini settings on the two machines?

Posted: Tue Feb 01, 2005 3:31 pm
by alix
im not able to do so, any information i could find by viewing data given from the phpinfo() function? if so, what should i look for?

Posted: Tue Feb 01, 2005 3:32 pm
by alix
also, what about using imap? is it possible to connect to a PoP3 just to send an email?

Posted: Thu Feb 03, 2005 10:21 am
by alix
lol, well i sorta figured it out..

used this code and it worked, instead of starting a new thread i'll keep it in here..

Code: Select all

$sent = @mail($to, test, $message, "From:$Emailer<$Emailer>\nReply-to:$Emailer2");

I dont exactly understand how it works, i know the mail function but i dont know that the @ does before it.

Also, how do i change the return-path? It gives me like root@myserver.com

Posted: Thu Feb 03, 2005 10:26 am
by feyd
the @ is an error control, it suppresses any error the function may throw.

As for setting return path, depending on your server's settings you can set it inside the header you pass, or in php.ini I believe.

Posted: Thu Feb 03, 2005 11:06 am
by alix
thanks, and who would have guessed the header info for the return-path would be "Return-Path:" lol, thanks