ZF-10864: Zend_Mail with SMTP Authentication


Hi All, I'm using Zend_Mail with SMTP authentication. while running that application it returns an error.(i.e, Application Error.). If I use the same code without SMTP authentication, its working fine. What i need to do...




Could you supply code to reproduce your issue, currently there is not enough info to know if this is a support request, or an actual bug with the framework.

If this is a support request, then this issue should be closed, and the question directed to either the fw-general mailing list, of #zftalk on IRC.

Assigned component and the mantainer.

I am using the Zend Framework with Magento

The standard getMail function in Magento doesn't support SMTP so I have replaced with the code below. It was working in the past, but now I am getting an exception.

I need to use SMTP as the mail server is another machine.

Code below:

public function getMail() { if (is_null($this->_mail)) { $my_smtp_host = Mage::getStoreConfig('system/smtp/host'); $my_smtp_port = Mage::getStoreConfig('system/smtp/port');

$config = array( //'ssl' => 'ssl', //optional 'port' => $my_smtp_port, //optional - default 25 'auth' => 'login', 'username' => 'xxx', 'password' => 'xxx' );

$transport = new Zend_Mail_Transport_Smtp('xxx', $config); Zend_Mail::setDefaultTransport($transport); $this->_mail = new Zend_Mail('utf-8'); } return $this->_mail; }

Stack trace below:

2010-12-13T15:07:24+00:00 ERR (3): exception 'Zend_Mail_Protocol_Exception' with message 'Operation not permitted' in /usr/home/xxx/domains/ Stack trace:

0 /usr/home/xxx/domains/ Zend_Mail_Protocol_Abstract->_connect('tcp://')

1 /usr/home/xxx/domains/ Zend_Mail_Protocol_Smtp->connect()

2 /usr/home/xxx/domains/ Zend_Mail_Transport_Smtp->_sendMail()

3 /usr/home/xxx/domains/ Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))

4 /usr/home/xxx/domains/ Zend_Mail->send()

5 /usr/home/xxx/domains/ Mage_Core_Model_Email_Template->send('orders@xxx...', NULL, Array)

6 /usr/home/xxx/domains/ Mage_Core_Model_Email_Template->sendTransactional('contacts_email_...', 'support', 'orders@xxx...', NULL, Array)

7 /usr/home/xxx/domains/ Mage_Contacts_IndexController->postAction()

8 /usr/home/xxx/domains/ Mage_Core_Controller_Varien_Action->dispatch('post')

9 /usr/home/xxx/domains/ Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))

10 /usr/home/xxx/domains/ Mage_Core_Controller_Varien_Front->dispatch()

11 /usr/home/xxx/domains/ Mage_Core_Model_App->run(Array)

12 /usr/home/xxx/domains/ Mage::run('', 'store')

13 {main}