我在其中配置了PHP mailer api,它在本地主机上工作,但在服务器上不工作.任何解决方案


i configured PHP mailer api in it is working in localhost but not working on server. any solution

我在托管EC2的amazon上配置了windows服务器2012。我在localhost上配置了一个PHP邮件api,但当我在服务器上部署这个应用程序时,它不起作用。当我在在线服务器上使用电子邮件时,它无法发送。我允许亚马逊Ec2实例上的TCP 25端口设置,也允许窗口中防火墙上的入站和出站规则。为什么不发送电子邮件?

如phpmailer页面所示:

至少你需要class.phpmailer.php。如果你使用SMTP,你需要class.SMTP.php,如果你在SMTP之前使用POP,你需要class.pop3.php.

所以我的猜测是,你需要根据你的服务器配置你的smtp。我将在下面为您提供他们的phpmailer示例:

$mail = new PHPMailer;
//$mail->SMTPDebug = 3;                            // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@example.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to
相关文章: