SMTP Autentifikácia
Zend_Mail podporuje použitie SMTP autentifikacie, ktorá môže
byť povolená nastavením parametra 'auth' v konfiguračnom poli konštruktora
Zend_Mail_Transport_Smtp. Dostupné autentifikačné metódy su
PLAIN, LOGIN a CRAM-MD5 a všetky očakávajú zadané 'username' a 'password'
v konfiguračnom poli.
Nastavenie SMTP autentifikácie v Zend_Mail_Transport_Smtp
<?php
require_once 'Zend/Mail.php';
require_once 'Zend/Mail/Transport/Smtp.php';
$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('sender@test.com', 'Some Sender');
$mail->addTo('recipient@test.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);
Druhy autentifikácie
Typy autentifikácie sú nezávislé na veľkosti písmen ale bez interpunkcie. Pre použitie napr.
CRAM-MD5 zadajte 'auth' => 'crammd5' v konštruktore Zend_Mail_Transport_Smtp.