Jump to content

Php Mail Function Not Working


toreachdeepak

Recommended Posts

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

Your email address is "myemail_address"? Also, check whether it works using sendmail directly.

Link to comment
Share on other sites

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...