如何在本地机器上运用zend_mail

本人想正在学习zend_framework,运用教程中的例子并不能成功发送邮件

我的代码如下:

//Create SMTP connection Object
		$configInfo = array('auth' => 'login',
							'ssl' => 'SSL',
							'username' => 'hello@gmail.com',
							'password' => 'hello',
							'port' => '465');
		$smtpHost = new Zend_Mail_Transport_Smtp('smtp.gmail.com',$configInfo);
		//Create Zend_Mail object.
		$MailObj = new Zend_Mail();
		//Initialize parameters.
		$emailMessage = "Hey, this is a Zend_Mail–created e-mail!";
		$fromEmail = "hello@gmail.com";
		$fromFullName = "hello";
		$to = "hello@126.com";
		$subject = "This is an example";
		$MailObj->setBodyText($emailMessage);
		$MailObj->setFrom($fromEmail, $fromFullName);
		$MailObj->addTo($to);
		$MailObj->setSubject($subject);
		
		//Send Email using transport protocol.
		try{
			$MailObj->send($smtpHost);
			echo "Email sent successfully";
		}catch(Zend_Mail_Exception $e){
			//Your error message here.
			echo 'error';
			echo $e->getMessage();
		}
		//Suppress the view.
		$this->_helper->viewRenderer->setNoRender();
	}

 php.ini配置也改了

[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 25

 

在服务器上运行显示错误:Warning : mail() [function.mail ]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. g4sm4028620wae.

 

希望哪位高人能够指点一下,非常感谢。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值