Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by bargainph )

PHPMailer

Download the distribution. Rename folder, phpmailerv2.3 to phpmailer. Save in Application/plugins directory. Create file and name to phpmailer_pi.php

CREDITS:

Author: Thorpe Obazee

website: pinoytech.org/
doc: Pinoy Smart Life
The original PHPMailer package http://phpmailer.codeworxtech.com/

phpmailer_pi.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function 
send_email($recipient$sender$subject$message)
{
    
require_once("phpmailer/class.phpmailer.php");

    
$mail = new PHPMailer();
    
$body $message;
    
$mail->IsSMTP();
    
$mail->FromName "Bargain Philippines";
    
$mail->From $sender;
    
$mail->Subject $subject;
    
$mail->AltBody strip_tags($message);
    
$mail->MsgHTML($body);
    
$mail->AddAddress($recipient);
    if ( ! 
$mail->Send())
    
{
        
echo 'Failed to Send';
    
}
    
else
    
{
        
echo 'Mail Sent';
    
}
}
?> 

From the controller:

<?php
    
public function forgot_password()
    
{
           $this
->load->plugin('phpmailer');
           
send_email('sample@sample.com''you@you.com''subject''message body');
        
}

?>