我已经在内部少数人使用的桌面上使用WAMPSERVER成功设置了一个Web应用程序,这使用了PHPMailer到内部SMTP服务器而没有加密或身份验证,并且它工作正常.
桌面崩溃,我已迁移到"新"桌面.我有一个SVN设置,所以我甚至使用了大多数相同的文件和配置.可能重要的一个区别是旧桌面是64位而新的是32位.这意味着我正在使用不同版本的WAMPSERVER.
邮件只是挂起.我没有得到PHP错误或PHP超时.我只是永远不会到达我的脚本的末尾.关于这个的疯狂部分是它与身份验证,ssl和gmail一起使用.它只是不适用于我需要的额外简单案例.
这有效:
<?php
require('class.phpmailer.php');
$mail=new PHPMailer();
$mail->ISSMTP();
$mail->Host='smtp.gmail.com';
$mail->Subject='test subj';
$mail->Body='the body email test';
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "myemail@gmail.com"; // GMAIL username
$mail->Password = "mypassword"; // GMAIL password
$mail->AddAddress('toemail@supersecret.com', 'John Doe'); …Run Code Online (Sandbox Code Playgroud)