<i id='xSMDQ'><tr id='xSMDQ'><dt id='xSMDQ'><q id='xSMDQ'><span id='xSMDQ'><b id='xSMDQ'><form id='xSMDQ'><ins id='xSMDQ'></ins><ul id='xSMDQ'></ul><sub id='xSMDQ'></sub></form><legend id='xSMDQ'></legend><bdo id='xSMDQ'><pre id='xSMDQ'><center id='xSMDQ'></center></pre></bdo></b><th id='xSMDQ'></th></span></q></dt></tr></i><div id='xSMDQ'><tfoot id='xSMDQ'></tfoot><dl id='xSMDQ'><fieldset id='xSMDQ'></fieldset></dl></div>
    <bdo id='xSMDQ'></bdo><ul id='xSMDQ'></ul>

<small id='xSMDQ'></small><noframes id='xSMDQ'>

  • <legend id='xSMDQ'><style id='xSMDQ'><dir id='xSMDQ'><q id='xSMDQ'></q></dir></style></legend>

        <tfoot id='xSMDQ'></tfoot>

        使用 Zend Mail 发送邮件时出现问题?

        Problem when sending mail with Zend Mail?(使用 Zend Mail 发送邮件时出现问题?)

        <small id='HbB5S'></small><noframes id='HbB5S'>

        • <i id='HbB5S'><tr id='HbB5S'><dt id='HbB5S'><q id='HbB5S'><span id='HbB5S'><b id='HbB5S'><form id='HbB5S'><ins id='HbB5S'></ins><ul id='HbB5S'></ul><sub id='HbB5S'></sub></form><legend id='HbB5S'></legend><bdo id='HbB5S'><pre id='HbB5S'><center id='HbB5S'></center></pre></bdo></b><th id='HbB5S'></th></span></q></dt></tr></i><div id='HbB5S'><tfoot id='HbB5S'></tfoot><dl id='HbB5S'><fieldset id='HbB5S'></fieldset></dl></div>
          <tfoot id='HbB5S'></tfoot>
              <bdo id='HbB5S'></bdo><ul id='HbB5S'></ul>
                  <tbody id='HbB5S'></tbody>

                  <legend id='HbB5S'><style id='HbB5S'><dir id='HbB5S'><q id='HbB5S'></q></dir></style></legend>
                • 本文介绍了使用 Zend Mail 发送邮件时出现问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 ZendMail 发送电子邮件(这个简单的脚本总结了它)

                  setBodyText('My Nice Test Text');$mail->setBodyHtml('My Nice Test Text');$mail->setFrom('test@example.com', 'Mr Example');$mail->addTo('contact@mypage.com', 'Mr Test');$mail->setSubject('TestSubject');$mail->send();?>

                  但是我得到了这个堆栈跟踪:

                  致命错误:未捕获的异常Zend_Mail_Transport_Exception"带有消息无法发送邮件".' 在/usr/share/php/libzend-framework-php/Zend/Mail/Transport/Sendmail.php:137堆栈跟踪:#0/usr/share/php/libzend-framework-php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()#1/usr/share/php/libzend-framework-php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))#2/var/www/hexreaction/mail/index2.php(11): Zend_Mail->send()#3 {main} 在第 137 行的/usr/share/php/libzend-framework-php/Zend/Mail/Transport/Sendmail.php 中抛出

                  我没有尝试使用 SMTP 来发送我的电子邮件,而且我遇到的问题不那么严重,但仍然是一个问题.

                   '登录','用户名' =>'contact@mypage.com','密码' =>'秘密通行证');$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);$mail = new Zend_Mail();$mail->setBodyText('这是邮件的正文.');$mail->setFrom('contact@mypage.com', 'Some Sender');$mail->addTo('contact@mypage.com', '某些收件人');$mail->setSubject('TestSubject');$mail->send($transport);?>

                  这个错误是这个错误,我真的不明白为什么:

                  致命错误:在第 7 行的/var/www/hexreaction/mail/index3.php 中找不到Zend_Mail_Transport_Smtp"类

                  编辑 2:

                  这是我最终的工作代码

                  require_once('Zend/Mail/Transport/Smtp.php');require_once 'Zend/Mail.php';$config = array('auth' => '登录','用户名' =>'somemail@mysite.com','密码' =>'somepass','ssl' =>'tls');$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);$mail = new Zend_Mail();$mail->setBodyText('这是邮件的正文.');$mail->setFrom('somemail@mysite.com', 'Some Sender');$mail->addTo('somemail@mysite.com', '某些收件人');$mail->setSubject('TestSubject');$mail->send($transport);

                  解决方案

                  正如您在堆栈跟踪中所见,Zend_Mail 使用 Zend_Mail_Transport_Sendmail 作为传输适配器.
                  因此,请确保您的系统上正在运行与 sendmail 兼容的 MTA(例如 Postfix).>

                  作为替代,您可以使用 Zend_Mail_Transport_Smtp 传输适配器并像这样使用外部 SMTP 服务器

                  $tr = new Zend_Mail_Transport_Smtp('mail.example.com', array('认证' =>'登录','用户名' =>$用户名,'密码' =>$密码,'端口' =>$端口,));Zend_Mail::setDefaultTransport($tr);

                  对于您的第二个问题:a

                  require_once('Zend/Mail/Transport/Smtp.php');

                  应该有帮助.

                  I'm trying to send an e-mail with ZendMail ( this simple script sums it up )

                  <?php
                  require_once 'Zend/Mail.php';
                  
                  $mail = new Zend_Mail();
                  $mail->setBodyText('My Nice Test Text');
                  $mail->setBodyHtml('My Nice Test Text');
                  $mail->setFrom('test@example.com', 'Mr Example');
                  $mail->addTo('contact@mypage.com', 'Mr Test');
                  $mail->setSubject('TestSubject');
                  $mail->send();
                  ?>
                  

                  However I get this stack trace:

                  Fatal error:
                  Uncaught exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. ' in /usr/share/php/libzend-framework-php/Zend/Mail/Transport/Sendmail.php:137
                  
                  Stack trace:
                  #0 /usr/share/php/libzend-framework-php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()
                  #1 /usr/share/php/libzend-framework-php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
                  #2 /var/www/hexreaction/mail/index2.php(11): Zend_Mail->send()
                  #3 {main} thrown in /usr/share/php/libzend-framework-php/Zend/Mail/Transport/Sendmail.php on line 137
                  

                  EDIT:

                  I'm not trying to use SMTP to send my e-mail and I'm having a less horrible problem, but still a problem.

                  <?php
                  require_once 'Zend/Mail.php';
                  $config = array('auth' => 'login',
                                  'username' => 'contact@mypage.com',
                                  'password' => 'secretpass');
                  
                  $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
                  
                  $mail = new Zend_Mail();
                  $mail->setBodyText('This is the text of the mail.');
                  $mail->setFrom('contact@mypage.com', 'Some Sender');
                  $mail->addTo('contact@mypage.com', 'Some Recipient');
                  $mail->setSubject('TestSubject');
                  $mail->send($transport);
                  ?>
                  

                  This throw's this error, I don't really get why:

                  Fatal error:
                  Class 'Zend_Mail_Transport_Smtp' not found in /var/www/hexreaction/mail/index3.php on line 7
                  

                  EDIT 2:

                  This is my final working code

                  require_once('Zend/Mail/Transport/Smtp.php');
                  require_once 'Zend/Mail.php';
                  $config = array('auth' => 'login',
                                  'username' => 'somemail@mysite.com',
                                  'password' => 'somepass',
                                  'ssl' => 'tls');
                  
                  $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
                  
                  $mail = new Zend_Mail();
                  $mail->setBodyText('This is the text of the mail.');
                  $mail->setFrom('somemail@mysite.com', 'Some Sender');
                  $mail->addTo('somemail@mysite.com', 'Some Recipient');
                  $mail->setSubject('TestSubject');
                  $mail->send($transport);
                  

                  解决方案

                  As you can see in the Stack trace Zend_Mail uses Zend_Mail_Transport_Sendmail as transport adapter.
                  So make sure a sendmail-compatible MTA (e.g. Postfix) is running on your system.

                  As an alternative you could use the Zend_Mail_Transport_Smtp transport adapter and use an external SMTP-Server like so

                  $tr = new Zend_Mail_Transport_Smtp('mail.example.com', array(
                      'auth'     => 'login',
                      'username' => $username,
                      'password' => $password,
                      'port'     => $port,
                  ));
                  Zend_Mail::setDefaultTransport($tr);
                  

                  Edit: For your 2nd Problem: a

                  require_once('Zend/Mail/Transport/Smtp.php');

                  should help.

                  这篇关于使用 Zend Mail 发送邮件时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <bdo id='DItUS'></bdo><ul id='DItUS'></ul>

                      • <tfoot id='DItUS'></tfoot>
                          <tbody id='DItUS'></tbody>

                          <i id='DItUS'><tr id='DItUS'><dt id='DItUS'><q id='DItUS'><span id='DItUS'><b id='DItUS'><form id='DItUS'><ins id='DItUS'></ins><ul id='DItUS'></ul><sub id='DItUS'></sub></form><legend id='DItUS'></legend><bdo id='DItUS'><pre id='DItUS'><center id='DItUS'></center></pre></bdo></b><th id='DItUS'></th></span></q></dt></tr></i><div id='DItUS'><tfoot id='DItUS'></tfoot><dl id='DItUS'><fieldset id='DItUS'></fieldset></dl></div>

                            <legend id='DItUS'><style id='DItUS'><dir id='DItUS'><q id='DItUS'></q></dir></style></legend>

                            <small id='DItUS'></small><noframes id='DItUS'>