如何在本地机器上运用zend_mail

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

我的代码如下:

//Create SMTP connection Object
		$configInfo = array('auth' => 'login',
							'ssl' => 'SSL',
							'username' => '[email protected]',
							'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 = "[email protected]";
		$fromFullName = "hello";
		$to = "[email protected]";
		$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.

 

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

你可能感兴趣的:(PHP,Gmail,Zend)