Jump to content

Mail Function


toreachdeepak
 Share

Recommended Posts

Hi,I am not sure why does below program doesn't send mail to $to. Even though I get "Mail Sent". This is happening on linux.<?php$to = 'b.kumar@nechclst.in';$subject = 'the subject';$message = 'hello';$headers = 'From: deepak.bhatia@nechclst.in' . "\r\n" . 'Reply-To: deepak.bhatia@nechclst.in' . "\r\n" . 'X-Mailer: PHP/' . phpversion();if(mail($to, $subject, $message, $headers)){ echo "Mail Sent";}else{ echo "Mail not sent";}?>

Edited by DeepakBhatia
Link to comment
Share on other sites

If the mail function returns true that means the mail server accepted the mail for delivery. If you have access, check the mail server logs to see if there's a problem sending or receiving. If you're using a cPanel server then there's a log for exim you can check to see messages from the outgoing mail server.

Link to comment
Share on other sites

  • 3 weeks later...

Look at this.........$to = 'b.kumar@nechclst.in';$subject = 'the subject';$message = 'hello';$headers = 'From: deepak.bhatia@nechclst.in' . "\r\n" .'Reply-To: deepak.bhatia@nechclst.in' . "\r\n" .'X-Mailer: PHP/'...........Is this a way to initialize a variable ???Use "the subject" instead of ' ' ha ??

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...