运输Zend电子邮件

时间:2013-07-02 00:44:58

标签: php zend-framework

我是PHP和Zend的新手。

我试图找出某些应用程序中使用的smtp服务器。它只有以下代码,不适用于任何传输设置(例如Zend_Mail_Transport_Smtp)。我也查看了application.ini等。我试图找出这个应用程序的用户名和密码。有关此信息可能存储的任何建议吗?

$mail = new Zend_Mail();
$mail->setFrom(Zend_Registry::get('config')->app->contact->email);
$mail->addTo($this->getUscEmail(), $this->getFirstName().' '.$this->getLastName());
$mail->addCc(Zend_Registry::get('config')->app->contact->email, 'SOWK FWS');
$mail->setSubject('Workstudy Documentation - '.$this->getFirstName().' '.$this->getLastName());
$mail->setBodyText('Hi '.$this->getFirstName().",\r\n".'Congratulations on completing your Orientation!);
$mail->send();

编辑1: 我的application.ini文件的这一部分:

##Application
app.invalid_login.max = 3
app.invalid_login.wait = 10
app.contact.email = cccc@ccc.com
app.admin.email = aaaaan@aaa.com
app.number_questions_to_ask.max = 5 
app.data_path  = APPLICATION_PATH "/../data/" 
app.pdf_path  = APPLICATION_PATH "/../data/PDF/" 

 ##Session
resources.session.save_path = APPLICATION_PATH "/../data/session"
resources.session.use_only_cookies = true
resources.session.remember_me_seconds = 3600
resources.session.name = "Work_Study"

php.ini:

[mail function]
; For Win32 only.
SMTP = email.ccc.com

; For Win32 only.
;sendmail_from = me@example.com
sendmail_from = example@ccc.com

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

这是我在使用它发送电子邮件之前打印传输对象的输出:

Transport ==> object(Zend_Mail_Transport_Sendmail)#215 (12) {
  ["subject"]=>
  NULL
  ["parameters"]=>
  NULL
  ["EOL"]=>
  string(2) "
"
  ["_errstr:protected"]=>
  NULL
  ["body"]=>
  string(0) ""
  ["boundary"]=>
  string(0) ""
  ["header"]=>
  string(0) ""
  ["_headers:protected"]=>
  array(0) {
  }
  ["_isMultipart:protected"]=>
  bool(false)
  ["_mail:protected"]=>
  bool(false)
  ["_parts:protected"]=>
  array(0) {
  }
  ["recipients"]=>
  string(0) ""
}

感谢。

1 个答案:

答案 0 :(得分:0)

也许他们没有使用SMTP并依赖Zend_Mail_Transport_Sendmail。这是ZF1(http://framework.zend.com/manual/1.12/en/zend.mail.introduction.html

中的默认值

Zend_Mail_Transport_Sendmail实现使用了php mail函数(http://php.net/manual/en/function.mail.php),我认为它不支持带身份验证的SMTP。

所以看起来你需要修改代码才能使用Zend_Mail_Transport_Smtp传输。

如果您需要有关设置SMTP传输的帮助,可以参考上一个问题:Send email using gmail smtp in zend?