1

I am trying to send mails through php script. I am trying with

<?php
$to = 'user@domain.com';
$subject = 'Test subject';
$message = 'Test message'; 
$from = 'user1@domain.com';
if(mail($to, $subject, $message)){
echo 'Your mail has been sent successfully.';
} else{
echo 'Unable to send email. Please try again.';
} 
?>

On execute am getting "Your mail has been sent successfully" message but no message is received in mailbox.

What i have to do further. My mails works on cakephp outlook configuration.But not with PHP. I have seen related questions in stackoverflow but no use :( Please let me know any other ways. Thanks in advance.

ndm
  • 59,784
  • 9
  • 71
  • 110
Shashikala
  • 457
  • 1
  • 8
  • 25

2 Answers2

0

for sending email you need to change fue things in php.ini here are the list to do the same. To check/change your PHP mail configuration:

  1. Open your php.ini file
  2. Search for the line that reads [mail function]
  3. Add/change the details of your mail server. This could be a local mail server or the mail server of your ISP.
  4. Save/close the php.ini file
  5. Restart your web server
Kishan Oza
  • 1,707
  • 1
  • 16
  • 38
0

Maybe your eror is: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. Check your php.ini file and try to var_dump some variables and check where is error. As error says, "From:" header missing.

proofzy
  • 627
  • 1
  • 12
  • 23