簡體   English   中英

PHPMailer - 掛起

[英]PHPMailer - Hangs

我正在嘗試通過 PHPMailer 發送電子郵件。 我已將 PHPMailer 文件解壓縮到服務器並擁有此代碼。 我有額外的“要求”,因為它已在其他帖子中建議發送時掛起。

它正在閱讀代碼,就好像我錯過了“主體”一樣,我收到一條錯誤消息。

我已經嘗試了多個不同代碼的示例,如下所示,都掛了。 我已經添加和修改,現在放棄了! 我有一個調用此代碼的簡單按鈕,瀏覽器(嘗試了多個)只是掛起。 任何想法我做錯了什么?

require 'PHPMailer/PHPMailerAutoload.php';
require 'PHPMailer/class.smtp.php';

$mail = new PHPMailer;

$mail->isSMTP();                // Set mailer to use SMTP

$mail->Host = 'smtp.eastlink.ca';  // Specify main and backup SMTP servers

$mail->Username = 'ns@eastlink.ca';                 // SMTP username

$mail->Password = '*******';                           // SMTP password

$mail->From = 'ns@eastlink.ca';

$mail->FromName = 'bob';

$mail->addAddress('dsmith@eastlink.ca', 'D');     // Add a recipient

$mail->addReplyTo('ns@eastlink.ca', 'Information');

$mail->isHTML(true);          // Set email format to HTML

$mail->Subject = 'Here is the subject';

$mail->Body    = 'This is the HTML message body <b>in bold!</b>';

$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {

    echo 'Message could not be sent.';

    echo 'Mailer Error: ' . $mail->ErrorInfo;

} else {

    echo 'Message has been sent';

}

您似乎沒有指定端口

嘗試添加:

$mail->SMTPAuth = true;
$mail->Port = 25;

請參閱: http : //my.eastlink.ca/customersupport/internet/faqs/email.aspx

根據 EastLink Doc,當與無線設備(未共享)連接時:

服務器類型:SMTP 端口:465 或 587 服務器名稱:smtp.eastlink.ca 使用 STARTTLS

所以嘗試:

$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
// OR 
$mail->SMTPSecure = 'tls';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM