smtp-mail I created one SMTP mail extension using phpmailer class

  1. Add the SMTP Details in main.php
  2. Create Mailfunction

Add the SMTP Details in main.php

Download the extension and add it into protected/extension folder. Now configure the smtp details in protected/config/main.php

'components'=>array(
        'Smtpmail'=>array(
            'class'=>'application.extensions.smtpmail.PHPMailer',
            'Host'=>"mail.yourdomain.com",
            'Username'=>'test@yourdomain.com',
            'Password'=>'test',
            'Mailer'=>'smtp',
            'Port'=>26,
            'SMTPAuth'=>true, 
        ),
),

Create Mailfunction

public function mailsend($to,$from,$subject,$message){
        $mail=Yii::app()->Smtpmail;
        $mail->SetFrom($from, 'From NAme');
        $mail->Subject    = $subject;
        $mail->MsgHTML($message);
        $mail->AddAddress($to, "");
        if(!$mail->Send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
        }else {
            echo "Message sent!";
        }
    }
3 0
14 followers
6 299 downloads
Yii Version: 1.1
License: GPL-3.0
Category: Mail
Tags: mail, mailer, smtp
Developed by: mbala
Created on: Feb 27, 2013
Last updated: 5 years ago

Downloads

show all

Related Extensions