Sunday, 15 April 2012

yii - Authentication with SMTP transport using Swiftmailer -



yii - Authentication with SMTP transport using Swiftmailer -

i'm using swiftmailer send emails in yii based application , works great, there no problems swiftmailer extension wrapper. want utilize smpt transport authenticate users in application against mail service server. code i'm using:

$sm = yii::app()->swiftmailer; $mailhost = 'xxx'; $mailport = xxx; // new transport $transport = $sm->smtptransport($mailhost, $mailport); $transport->setusername($username); $transport->setpassword($password); $transport->start(); if($transport->isstarted()){ // authenticated; }else{ // error; } $transport->stop();

this isn't working. when set real login credentials instantly logs in. when type wrong ones, spends time @ lastly logs in too. don't know why happens because when using real credentials swiftmailer can send emails. i'm using right api functions? i'm doing wrong?

looking @ the source, when phone call start(), started set true.

i'm not familiar switfmailer, looks you'll want check results of authenticate()

authentication yii smtp swiftmailer

No comments:

Post a Comment