dqo58772 2012-11-26 21:25
浏览 97
已采纳

无法在wamp中使用假sendmail发送电子邮件

I have been doing this for hours and can't get it to work, many comments in the tutorial said it works like a charm but I can't really make this work.

I have done all the steps here http://blog.techwheels.net/send-email-from-localhost-wamp-server-using-sendmail/ and read all the comments with problems other users encountered and also used the solutions replied.

What I see on the apache error log is this

[Tue Nov 27 05:19:47 2012] [notice] Parent: Created child process 4120
[Tue Nov 27 05:19:47 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Nov 27 05:19:48 2012] [notice] Child 4120: Child process is running
[Tue Nov 27 05:19:48 2012] [notice] Child 4120: Acquired the start mutex.
[Tue Nov 27 05:19:48 2012] [notice] Child 4120: Starting 64 worker threads.
[Tue Nov 27 05:19:48 2012] [notice] Child 4120: Starting thread to listen on port 80.
[Tue Nov 27 05:19:48 2012] [notice] Child 4120: Starting thread to listen on port 80.

I also have tried it on my other computer and it has the same error log. I have disabled my firewall and also critically followed the steps on the tutorial.

  • 写回答

1条回答 默认 最新

  • drb88830 2012-11-27 10:57
    关注

    Sorry for the previous answer. Thanks everyone for your suggestions to improve my answer. Here is my answer: The phpmailer has a file called class.phpmailer.php. Then in the function smtpmailer($to, $from, $from_name, $subject, $body) the code goes as follows:

    global $error;
    $mail = new PHPMailer(); 
    $mail->IsSMTP(); 
    $mail->SMTPDebug = 0; 
    $mail->SMTPAuth = true;  
    $mail->SMTPSecure = 'ssl'; 
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465; 
    $mail->Username = 'gmailusername';  
    $mail->Password = 'gmailpassword';           
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
        $mail->IsHTML(True);
        $mail->Body=$body;
    //$mail->Body = $body;
    $mail->AddAddress($to);
    if(!$mail->Send()) {
        $error = 'Mail error: '.$mail->ErrorInfo; 
        return false;
    } else {
        $error = 'Message sent!';
        return true;
    }
    

    Then just call the function where ever you want as: smtpmailer($to, $from, $headers, $subject, $message);

    Oh and prior to this make sure php_openssl extension is enabled.

    I hope this answer of mine was helpful. :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀