ZF-10864: Zend_Mail with SMTP Authentication

Description

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...

Thanks...

Comments

Habeeb,

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 1.4.2.0.

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/xxx.co.uk/public_html/lib/Zend/Mail/Protocol/Abstract.php:254 Stack trace:

0 /usr/home/xxx/domains/xxx.co.uk/public_html/lib/Zend/Mail/Protocol/Smtp.php(167): Zend_Mail_Protocol_Abstract->_connect('tcp://mail.xxx...')

1 /usr/home/xxx/domains/xxx.co.uk/public_html/lib/Zend/Mail/Transport/Smtp.php(199): Zend_Mail_Protocol_Smtp->connect()

2 /usr/home/xxx/domains/xxx.co.uk/public_html/lib/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()

3 /usr/home/xxx/domains/xxx.co.uk/public_html/lib/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))

4 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(409): Zend_Mail->send()

5 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Model/Email/Template.php(462): Mage_Core_Model_Email_Template->send('orders@xxx...', NULL, Array)

6 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Contacts/controllers/IndexController.php(104): Mage_Core_Model_Email_Template->sendTransactional('contacts_email_...', 'support', 'orders@xxx...', NULL, Array)

7 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Contacts_IndexController->postAction()

8 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('post')

9 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))

10 /usr/home/xxx/domains/xxx.co.uk/public_html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()

11 /usr/home/xxx/domains/xxx.co.uk/public_html/app/Mage.php(596): Mage_Core_Model_App->run(Array)

12 /usr/home/xxx/domains/xxx.co.uk/public_html/index.php(80): Mage::run('', 'store')

13 {main}