Bharanikumar
Bharanikumar

Reputation: 25733

zend SMTP No connection could be made because the target machine actively refused

The snippet below:

$config = array('auth' => 'login',
                'username' => 'myusername',
                'password' => 'password');

$transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);

$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('[email protected]', 'Some Sender');
$mail->addTo('[email protected]', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);

...is throwing the following error:

"No connection could be made because the target machine actively refused."

What is the mistake in the snippet? I just took it from the zend framework online tutorial.

Thanks in advance.

Upvotes: 0

Views: 993

Answers (1)

Birju Shah
Birju Shah

Reputation: 1220

well try adding this to your configuration for SMTP

$config = array('auth' => 'login',
'username' => 'myusername',
'password' => 'password'
'ssl' => 'ssl',
'port' => $port
);

$port may vary according to the SMTP Provider generally its 465 but go through the SMTP service provider manual/help for correct port.

Hope this helps

Upvotes: 3

Related Questions