PHPMailer

Can anyone tell me a step by step tutorial of installing PHPMailer in Yii application?

have a look here

http://www.yiiframework.com/extension/mailer

Any other easy tutorial because i could not understand?

  1. download and unzip it

  2. put phpmailer.php, and class.smtp.php in your components folder

  3. use it like this:

$mail = new phpmailer();

$mail->IsSMTP();

$mail->Host = "host.name";

$mail->Username = "user@example.com";

$mail->Password = "your smtp password";

$mail->SetFrom("from@example.com", "Full Name");

$mail->AddAddress("sendto@example.com");

$mail->Subject = "hello world";

$mail->Body = "buy viagra!";

$mail->Send();

Okay but where i use above codes?

The codes el chief posted should be posted in an action in your controller.

To Configure PHPmailer with gmail following configuration will do,

Yii::import(‘application.extensions.phpmailer.JPhpMailer’);

$mail = new JPhpMailer;

$mail->IsSMTP();

$mail->SMTPDebug = 1;

$mail->Host = ‘smtp.gmail.com’;

$mail->SMTPAuth = true;

$mail->SMTPSecure = "ssl";

$mail->Username = ‘name@gmail.com’;

$mail->Port = ‘465’;

$mail->Password = ‘pwd’;

$mail->SetFrom(‘mailid@gmail.com’, ‘name’);

$mail->Subject = ‘PHPMailer Test Subject via GMail, basic with authentication’;

$mail->AltBody = ‘To view the message, please use an HTML compatible email viewer!’;

$mail->MsgHTML(‘JUST A TEST!’);

$mail->AddAddress(‘mail@gmail.com’, ‘name’);

$mail->Send();

In my case it was a lack of SSL support in PHP which gave this error.

So I enabled extension=php_openssl.dll

$mail->SMTPDebug = 1; also hinted towards this solution.

Since this is one of your first posts, you are not allowed to embed links in your post.

Below is the content of your post:

Though the bug is solved but I would like to inform by this post that JPhpMailer uses Famous PHP Mailer phpmailer(dot) worxware(dot)com/

Always try to use the latest version from the authors site.

I was having an issue with PHP mailer where I was trying to send files in Attachment.

The issue was the File was sent as base64 Encoded Encryption(When the Extension was used in Linux Centos Server) and surprisingly it was working fine when the same code was written in a windows hosted machine.

The Version with issues was 5.1 and the proper working version was 5.2.8 (Version mentioned are of PHP mailer)

Hope this post may help anyone facing the issue. Can let me know if I can help anyone for the same.