Hi I have used sendgrid to send emails in the past and am using it as a reset password on an app currently. I want to use it for another app also. My AWS has a new instance for the second app. I have copied the sendmail.ini from my first instance and the php.ini and I am using basically the same code for sending emails in my php files. The first is working, the second isn't. Code below:
$subject = "Don't be stuck for a password!" ;
$Emessage = wordwrap("<html><body>Please click the link below to reset your password. <br><br> <a href=http://xxx.xxx.xx/resetPassword.php?AuthCode=".$Token."&email=".$email."&userid=".$userid." />Reset Password</a><br><br> Thanks, <br></body></html>", 70, "\r\n");
$from= "xxx@xxx.com";
$from_name="xxx Ltd.";
$headers = "Date: ". date("r") ."\r\n". "From: $from_name <$from>\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//echo $message;
$mailSent= mail($email, $subject, $Emessage, $headers);
if (!$mailSent){
//$reset= error_get_last();
$reset='Not OK';
}
Note the mailSent is returning true. It must be some config issue. Also, I am running the same version of xampp on both instances.
My sendmail.ini is as follow:
[sendmail]
smtp_server=smtp.sendgrid.net
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=xxx
auth_password=yyy
force_sender=xxx@xxx.com
and my php.ini has the following in the [mail function]:
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" - t"