我正在尝试几天通过godaddy帐户从我的网站发送电子邮件。 我不知道服务器端是否有任何特殊配置(godaddy) 我不知道我的PHP代码是否也有任何错误。 我真的需要弄清楚如何发送电子邮件。 谢谢,里卡多。
Fatal error: Call to undefined method Zend\Form\Element::getFieldsets() in …
答案 0 :(得分:0)
try {
// your mail code
// $mail->send();
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
答案 1 :(得分:0)
SERVER -> CLIENT: 220-a2plcpnl0321.prod.iad2.secureserver.net ESMTP Exim 4.85 #2 Fri, 26 Feb 2016 16:15:57 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO warneracademy.com
SERVER -> CLIENT: 250-a2plcpnl0321.prod.iad2.secureserver.net Hello a2plcpnl0321.prod.iad2.secureserver.net [*************]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: cmVxdWVzdEB3YXJuZXJhY2FkZW15LmNvbQ==
SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: Kio5OUtLbGw=
SERVER -> CLIENT: 235 Authentication succeeded
CLIENT -> SERVER: MAIL FROM:<**************>
SERVER -> CLIENT: 250 OK
CLIENT -> SERVER: RCPT TO:<*************>
SERVER -> CLIENT: 250 Accepted
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 Enter message, ending with "." on a line by itself
CLIENT -> SERVER: Date: Fri, 26 Feb 2016 23:15:52 +0000
CLIENT -> SERVER: To: Ricardo Scarpim <**************>
CLIENT -> SERVER: From: WarnerAcademy <**************>
CLIENT -> SERVER: Subject: PHPMailer SMTP test
CLIENT -> SERVER: Message-ID: <5fa4a06963e0e5c2e64a8e88e553bc10@warneracademy.com>
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.13 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_5fa4a06963e0e5c2e64a8e88e553bc10"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10
CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: This is a plain-text message body
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10
CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: <i>This is the Link to change your password:</i>
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 250 OK id=1aZRc5-001CJG-Tk
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 a2plcpnl0321.prod.iad2.secureserver.net closing connection
Message sent!
答案 2 :(得分:0)
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
//$mail->isSMTP();
//isSMTP seems to be the problem.. because it sends locally
$mail->SMTPDebug = 0;
//$mail->DKIM_domain = '127.0.0.1';
$mail->Host = "localhost";
$mail->Port = "25";
$mail->SMTPSecure = "none";
$mail->SMTPAuth = false;
$mail->Username = "";
$mail->Password = "";
答案 3 :(得分:0)
我知道这并非原始帖子所寻找的解决方案,但是对于任何正在通过GoDaddy或任何其他托管服务发送电子邮件的局限性的人来说,这可能是一个有用的解决方法。通过该解决方案,您可以从具有登录凭据的任何其他帐户通过Gmail发送电子邮件。
要求: Gmail帐户,XAMPP或类似的本地Web服务器,PHPMailer库 (有关如何使用XAMPP和PHPMailer的教程,可在在线上找到)
说明: 1.转到您的Gmail帐户中的“设置”。在“帐户和导入”下,在“发送邮件为”部分中添加“ youraccount@domainyouown.com”。 2.在您的PHP脚本(使用PHPMailer库)中,将以下代码行中的凭据替换为您的Gmail凭据和您要从其发送的帐户:
$mail->Username = 'username@gmail.com';
$mail->Password = 'yourpassword';
$mail->setFrom('youraccount@domainyouown.com', 'Your Name');
$mail->addReplyTo('youraccount@domainyouown.com', 'Your Name');
此方法的其他优点:
如果我在任何一个方面有误或建议更好的方法,请随时纠正我。到目前为止,这只是我找到的最优雅的解决方案!