0

I have a PHP simple code which supposed to send an email, but it seems it does not work since I have never received any mail. Well I have a free free host and domain with CPanel that I have a Webmail feature there, I can send email through that to wherever I want (Yahoomail, Gmail, ..). I really do not know how to solve it. Here is my php code:

$to = 'sample@yahoo.com'; 
$subject = 'the subject'; 
$message = 'hello'; 
$headers = 'From: sample@sample.com' . "\r\n" . 'Reply-To: sample@sample.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); 
mail($to, $subject, $message, $headers);`

My sendmail_path /usr/local/bin/phpsendmail, Path to sendmail /usr/local/bin/phpsendmail, SMTP localhost, smtp_port 25

Ivan
  • 2,463
  • 1
  • 20
  • 28
Sparks Sh
  • 109
  • 1
  • 12
  • I think you can find a fix here: http://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server – R.You May 06 '16 at 10:44

1 Answers1

-1

Try this ... $to = "somebody@example.com"; $subject = "My subject"; $txt = "Hello world!"; $headers = "From: webmaster@example.com" . "\r\n" . "CC: somebodyelse@example.com"; mail($to,$subject,$txt,$headers);

MoreNeeds
  • 9
  • 2