1

I am trying to send mail from contact form but unfortunately I don’t get any mail yet my code runs successfully. It shows that mail is sent but I haven’t received any mail. I don’t know what’s the issue. Does any one know about the solution?? They are welcome.

<?php
error_reporting(-1);
ini_set('display_errors', 'On');
set_error_handler("var_dump");

ini_set("mail.log", "/tmp/mail.log");
ini_set("mail.add_x_header", TRUE);
$message = "Line 1\r\nLine 2\r\nLine 3";

$message = wordwrap($message, 70, "\r\n");

if(mail('abc@xyz.com', 'My Subject', $message))
{
echo $message." sent successfully";
}

?>

Thanks in advance :)

Leena Patel
  • 2,423
  • 1
  • 14
  • 28

1 Answers1

3

I hope this will help you. i am also using this code, try this code:

$email = 'abc@gmail.com';  
$password = '$email';  
$hash = md5(rand(0,1000));
$to = '$email'; 
$subject = 'Registration | Verification'; 
$message = 'Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below.                          
------------------------
    Email: '.$email.'
    Password: '.$password.'
------------------------
Please click this link to activate your account:http://abc.yourdomain.com/register/activate.php?email='.$email.'&hash='.$hash.''; 
$headers = 'From:admin@thedigitalmarketingonline.com' . "\r\n"; 
mail($to, $subject, $message, $headers);