Reputation: 49
Hi can anyone help why can't I send email to a gmail account.I have been doing change password module and to confirm the password i will send the confirmation link to my clients email account.Many have contact me that they have not receive any emails. Here's my code:
$headers .= "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "From: ".$from;
mail($sendmail_recipient_email, $sendmail_subject, $sendmail_message, $headers);
Upvotes: 0
Views: 1303
Reputation: 14489
Well for one, your $headers
are just going to be
"From: ".$from;
because you're not using a concatenation operator. Should be:
$headers .= "From: ".$from;
note the .=
The OP corrected the code in the question, so I'll modify my answer. There are LOTS of reasons that gmail might be rejecting your emails, but a good first step would be to remove the \r
line-break modifiers. \n
should suffice, and lots of folks seem to have solved this exact issue (specific rejection by Gmail) by only using new-line breaks and excluding return breaks.
Upvotes: 1