[SOLVED] my problem with mail() function?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alix
Forum Commoner
Posts: 42
Joined: Thu Nov 18, 2004 8:41 am

[SOLVED] my problem with mail() function?

Post 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
johndoe132
Forum Newbie
Posts: 13
Joined: Thu Sep 30, 2004 5:09 am

Post by johndoe132 »

Alix,
Have you compared the php.ini settings on the two machines?
alix
Forum Commoner
Posts: 42
Joined: Thu Nov 18, 2004 8:41 am

Post 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?
alix
Forum Commoner
Posts: 42
Joined: Thu Nov 18, 2004 8:41 am

Post by alix »

also, what about using imap? is it possible to connect to a PoP3 just to send an email?
alix
Forum Commoner
Posts: 42
Joined: Thu Nov 18, 2004 8:41 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
alix
Forum Commoner
Posts: 42
Joined: Thu Nov 18, 2004 8:41 am

Post by alix »

thanks, and who would have guessed the header info for the return-path would be "Return-Path:" lol, thanks
Post Reply