0

我在我的网站 (contacts.html) 中有一个页面,作为向特定源发送电子邮件的表单(创建用于接收来自不同源的电子邮件的电子邮件)。我使用邮戳作为主机。

这是发送电子邮件的代码(使用 phpmailer,并且已经有 html 表单):

if(isset($_POST['send'])){

$name = $_POST['sendName'];
$email = $_POST['sendEmail'];
$subject = $_POST['sendSubject'];
$message = $_POST['sendMessage'];
$password = $_POST['sendPass'];

require_once('phpmailer/class.phpmailer.php');
require_once('phpmailer/class.smtp.php');
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Priority = 1; // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.postmarkapp.com";
$mail->Port = 2525; // or 587 //or 25
$mail->IsHTML(true);
$mail->Username = $email;
$mail->Password = $password;
$mail->From = $email;
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AddAddress("teste2x2016@gmail.com","jon");

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}

}

所以问题是我传递了同一电子邮件的电子邮件和密码(当有人想向我创建的电子邮件发送电子邮件时),代码失败如下:

SMTP -> 错误:不接受来自服务器的密码:535 5.7.8 错误:身份验证失败:UGFzc3dvcmQ6 SMTP -> 错误:不接受来自服务器的 RCPT:454 4.7.1:中继访问被拒绝 SMTP 错误:以下收件人失败:teste2x2016@ gmail.com 邮件程序错误:SMTP 错误:以下收件人失败:teste2x2016@gmail.com SMTP 服务器错误:4.7.1:中继访问被拒绝

4

0 回答 0