toreachdeepak Posted September 17, 2009 Share Posted September 17, 2009 Hi,The php mail function is not working on linux.Please help in understanding which settings are required.I have done following settings on my linux machine; For Unix only. You may supply arguments as well (default: "sendmail -t -i").sendmail_path = /usr/sbin/sendmail -tsendmail_from = myemail_addressThanksDeepak Link to comment Share on other sites More sharing options...
Synook Posted September 17, 2009 Share Posted September 17, 2009 Your email address is "myemail_address"? Also, check whether it works using sendmail directly. Link to comment Share on other sites More sharing options...
toreachdeepak Posted September 17, 2009 Author Share Posted September 17, 2009 Your email address is "myemail_address"? Also, check whether it works using sendmail directly.Actually my email address is deepak.bhatia@nechclst.in, I had put that just for example.Will it possible to guide me in this regard ?ThanksDeepak Link to comment Share on other sites More sharing options...
justsomeguy Posted September 17, 2009 Share Posted September 17, 2009 What happens when you try to use the mail function? Link to comment Share on other sites More sharing options...
jeffman Posted September 17, 2009 Share Posted September 17, 2009 What happens when you try to use the mail function?Are you getting any warning or error messages? Is mail() returning true or false? Are you certain the code is even parsing correctly? Link to comment Share on other sites More sharing options...
toreachdeepak Posted September 18, 2009 Author Share Posted September 18, 2009 Are you getting any warning or error messages? Is mail() returning true or false? Are you certain the code is even parsing correctly?Hi,For the code below, the web page waits for a minute or so and then prints "Mail Sent". The mail returns true means ut has worked.<?php$Name = "Da Duder"; //senders name$email = "deepak.bhatia@nechclst.in"; //senders e-mail adress$recipient = "deepak.bhatia@nechclst.in"; //recipient$mail_body = "The text for the mail..."; //mail body$subject = "Subject for reviever"; //subject$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfieldsmail($recipient, $subject, $mail_body, $header); //mail command ?><h1>Mail Sent</h1> Link to comment Share on other sites More sharing options...
Synook Posted September 18, 2009 Share Posted September 18, 2009 How can you tell the mail() function returns true? Check it: if (mail($recipient, $subject, $mail_body, $header)) echo "Mail sent.";else echo "Mail not sent."; Also, if everything seems to work check your spam folder. Link to comment Share on other sites More sharing options...
toreachdeepak Posted September 18, 2009 Author Share Posted September 18, 2009 How can you tell the mail() function returns true? Check it:if (mail($recipient, $subject, $mail_body, $header)) echo "Mail sent.";else echo "Mail not sent."; Also, if everything seems to work check your spam folder. Yes even my spam folder is not showing anything though I get "Mail Sent" message. Link to comment Share on other sites More sharing options...
toreachdeepak Posted September 18, 2009 Author Share Posted September 18, 2009 Hi,The mail is working fine on windows but on linux it is giving problem.Could this be due to apache is running with ssl ?RegardsDeepak Link to comment Share on other sites More sharing options...
justsomeguy Posted September 18, 2009 Share Posted September 18, 2009 SSL is not the issue. You should be checking the return value of the mail function, the code you posted doesn't tell you if it succeeded or not, you always print the same message no matter what happens. If there's a delay in sending the mail it probably can't connect to the mail server. Make sure errors are being reported also:error_reporting(E_ALL);ini_set('html_errors', 1);ini_set('display_errors', 1); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.