【发布时间】:2021-02-18 21:15:19
【问题描述】:
我正在服务器 ubuntu 18.04 上的 amazon aws ec2 上工作...我正在尝试使用 phpmailer 发送邮件..当我点击发送邮件时,它显示我发送邮件的消息...但我没有收到任何邮件。当我去 mail.log 文件检查它显示的错误时..它显示以下错误
postfix/smtp[32208]: warning: database /etc/postfix/sasl_passwd.db is older than source file /etc/postfix/sasl_passwd
Nov 6 05:33:52 ip-172-31-16-223 postfix/smtp[32208]: ECD64BE5CC: to=<archipatel20@gmail.com>, relay=mail.uway.in[166.62.28.116]:587, delay=1.9, delays=0.01/0.02/1.6/0.23, dsn=5.0.0, status=bounced (host mail.uway.in[166.62.28.116] said: 550 SMTP AUTH is required for message submission on port 587 (in reply to RCPT TO command))
Nov 6 05:33:52 ip-172-31-16-223 postfix/cleanup[32206]: C81D4BE60F: message-id=<20201106053352.C81D4BE60F@ip-172-31-16-223.us-east-2.compute.internal>
Nov 6 05:33:52 ip-172-31-16-223 postfix/qmgr[32200]: C81D4BE60F: from=<>, size=2669, nrcpt=1 (queue active)
Nov 6 05:33:52 ip-172-31-16-223 postfix/bounce[32210]: ECD64BE5CC: sender non-delivery notification: C81D4BE60F
Nov 6 05:33:52 ip-172-31-16-223 postfix/qmgr[32200]: ECD64BE5CC: removed
Nov 6 05:33:54 ip-172-31-16-223 postfix/smtp[32208]: C81D4BE60F: to=<crm@uway.in>, relay=mail.uway.in[166.62.28.116]:587, delay=1.8, delays=0/0/1.6/0.22, dsn=5.0.0, status=bounced (host mail.uway.in[166.62.28.116] said: 550 SMTP AUTH is required for message submission on port 587 (in reply to RCPT TO command))
Nov 6 05:33:54 ip-172-31-16-223 postfix/qmgr[32200]: C81D4BE60F: removed
这也是我发送邮件的 php 代码:
<?php
$output = 'here is my html code';
if(isset($_POST["action"]))
{
include('../conn.php');
$getid = $_GET['id'];
$queryd = "SELECT * FROM `salary_sleep_gen` WHERE `id`='$getid'";
$rund = mysqli_query($conn, $queryd);
while ($rowd = mysqli_fetch_array($rund)) {
$emaild = $rowd['email'];
$monthbname = $rowd['month_name'];
$yearb = $rowd['year'];
$emp_nameb = $rowd['emp_name'];
}
include('pdf.php');
$file_name = md5(rand()) . '.pdf';
$html_code = '<link rel="stylesheet" href="bootstrap.min.css">';
$html_code .= fetch_customer_data($connect);
$pdf = new Pdf();
$pdf->load_html($html_code);
$pdf->render();
$file = $pdf->output();
file_put_contents($file_name, $file);
require 'class/class.phpmailer.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->SMTPDebug = 0;
$mail->IsMail();
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;
$mail->addAddress($emaild);
$mail->isHTML = true;
$mail->From = 'hr@sorbeadindia.com'; //Sets the From email address for the message
$mail->FromName = 'SORBEAD INDIA';
$mail->AddAttachment($file_name);
$mail->Subject = "Salary Slip -" . $monthbname." ".$yearb;
$mail->Body = "html";
$mail->AltBody = "alt";
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML("Salary Slip (".$emp_nameb.") -".$monthbname." ".$yearb);
//Replace the plain text body with one created manually
$mail->AltBody = 'Salary Slip ('.$emp_nameb.') -'.$monthbname.' '.$yearb;
//send the message, check for errors
if (!$mail->send()) {
$message = "Mailer Error: " . $mail->ErrorInfo;
} else {
$message = "Message sent!";
}
unlink($file_name);
}
?>
我是aws的初学者,所以请帮助我并为这个错误提供一些解决方案。
【问题讨论】:
标签: amazon-web-services amazon-ec2 smtp phpmailer postfix-mta