PHPMailer :: Mail不发送

时间:2011-06-20 00:56:22

标签: email phpmailer

[mail function]
; For Win32 only.
;SMTP = localhost;
smtp_port = 25

; For Win32 only.
;sendmail_from = me@localhost.com;

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i;

我已将class.phpmailer.php(PHP4的PHPMailer v2.0.4)放入与此页面相同的文件夹中并上传到服务器,我将php.ini [mail函数]保留为默认值,如图所示以上。我没有将class.smtp.php脚本放在一起(我实际上尝试但它不起作用,所以我删除它。)。毕竟我仍然没有收到任何发送的电子邮件。使用我的代码它不会产生任何错误,我只是没有收到发送的电子邮件。我看不出问题出在哪里,有人可以告诉我问题出在哪里吗?谢谢。

    require("class.phpmailer.php");
    $mail = new PHPMailer();$mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host ="mail.testing.com";
    $mail->SMTPAuth = true;
    $mail->Username = 'testinguser';
    $mail->Password = 'testingpassword';
    $mail->Port = '26';
    $mail->CharSet="utf-8";

    $emailbody = "<p>You have recieved a new message from the enquiries form on your website.</p>
                  <p><strong>First Name: </strong> {$firstname} </p>
                  <p><strong>Surname: </strong> {$surname} </p>
                  <p><strong>STD: </strong> {$std} </p>
                  <p><strong>Phone: </strong> {$telephone} </p>
                  <p><strong>Company Name: </strong> {$company} </p>
                  <p><strong>Email Address: </strong> {$email} </p>
                  <br />

                  <p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";

    $mail->AddAddress("recipient@receiver.com");
    $mail->Subject = "New Enquiry";
    $mail->Body = $emailbody;

    if(!$mail->Send())
    {
        echo "Error sending: " . $mail->ErrorInfo;;
    }
    else
    {
        echo "Letter is sent";  
    }

0 个答案:

没有答案
相关问题