douzhang5984 2018-06-27 05:03
浏览 46

使用phpmailer附加嵌入式图像时,Windows 7崩溃

I am writing a script to send birthday messages automatically to employees. For now I have taken hard-coded email ids. Now the problem is that these scripts are working perfectly well on my laptop Windows 10 Wampserver3.0.6. But now when I am transfering these files to the main desktop in the office(Windows 7 Wampserver3.1.3), the email sending based scripts crash the computer when you embed or attach an image. If I remove the attachment and send only the text, the email gets sent. But on attaching an image the computer crashes directly. The code is as follows:

require("PHPMailer-master\src\PHPMailer.php");
require("PHPMailer-master\src\SMTP.php");
require("PHPMailer-master\src\Exception.php");
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();                
$mail->SMTPDebug = 1;               
$mail->SMTPAuth = true;             
$mail->SMTPSecure = 'ssl';          
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;                                      
$mail->IsHTML(true);
$mail->Username = "abc@gmail.com";
$mail->Password = "********";
$mail->SetFrom("abc@gmail.com");
$mail->Subject = "Happy birthday!";
$mail->AddEmbeddedImage('compressed.jpg', 'compressed');
$mail->Body = "<h1>Happy Birthday!</h1><br>Have a wonderful day!";
$mail->AddAddress("abc@gmail.com","def@hotmail.com");
 if(!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
 } else {
    echo "Message has been sent";
 }

I have tried so many things. I have increased the memory_limit of wamp server. An additional thing, debug=1 displays the process on chrome. So if i embed an image, it stops halfway, it does not display the process completely and crashes in the middle. NOTE: addAttachment() works well but addEmbeddedImage() crashes the computer It works perfectly well on my laptop. Please help.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)