sendmail — функция почты php не работает ответить SMTP-ответ сервера: 503

Я пытаюсь отправить почту, используя функцию php mail. но я получаю ошибку вроде:

PHP Warning:  mail(): SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in C:\Inetpub\vhosts\qubedns.co.in\httpdocs\Codes\design\rnp\mailsend.php on line 21

Вот мой сценарий PHP:

<?php

$toEmail    = 'bikash336@gmail.com';
$subject    = 'hello';
$message    = 'Users are able to send emails to local domains and addresses but are unable to send email to any external address.';
$headers    = "MIME-Version: 1.0" . "\r\n";
$headers    .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers    .= 'From: <sales@leonwallet.com>' . "\r\n";

$Status = mail($toEmail,$subject,$message,$headers);

if($Status){
echo '1';
}else{
echo '0';
}

?>

Вот моя конфигурация сервера: http://qubedns.co.in/codes/php/

Что со мной не так?

0

Решение

Я нашел решение с помощью PHPMailer.
Это работа для меня.

<?php
require('mailserver/PHPMailerAutoload.php');
require('mailserver/class.phpmailer.php');
require('mailserver/class.smtp.php');
require('mailserver/class.pop3.php');

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet="UTF-8";
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->IsHTML(true);
$mail->Username = 'sales@leonwallet.com';
$mail->Password = 'password';
$mail->From = 'sales@leonwallet.com';
$mail->FromName = 'Leon Sales Team';
$mail->AddAddress($to);
$mail->AddReplyTo('sales@leonwallet.com', 'Leon Sales Team');
$mail->Subject = $sub;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->Body = $message;
if(!$mail->Send()){
echo "1"; // ERROR
}else{
echo "0"; // SUCCESS
}
?>
0

Другие решения

Вот решение. Для меня он решил проблему

Когда я изменил среду, параметр TO был настроен с доменом моего проекта тестирования / разработки.
Я изменил адрес электронной почты на рабочий адрес, и ошибка исчезла.

Вот решение: http://www.marathon-studios.com/blog/php-mail-503-error/

0

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector