Я попробовал то, что говорилось в ответах, и моя почта по-прежнему не отправляется на Gmail. Я собирался оставить комментарий к этому вопросу, но ему было 6 лет. Вот два метода, которые я использую. Один из них — заголовки по умолчанию, другой — для отправки им почты:
Код: Выделить всё
public function sendActivationEmail() : bool {
return mail($this->to,$this->subject,$this->getMessage(),$this->getHeaders());
}
protected function getDefaultHeaders() : string {
// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: info@abc.com\r\n";
$headers .= "Reply-To: info@abc.com\r\n";
$headers .= "Cc: Client Tracker New User \r\n";
$headers .= "X-Sender: Client Tracker \r\n";
$headers .= 'X-Mailer: PHP/' . phpversion()."\r\n";
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: farrier.clienttracker@gmail.com\r\n"; // Return path for errors
return $headers;
}
Подробнее здесь: https://stackoverflow.com/questions/760 ... -not-gmail
Мобильная версия