Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 11 revisions

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

[h4]CREDITS:[/h4] [b]Author: Thorpe Obazee (danfreak)

website: [url=http://pinoytech.org/]pinoytech.org/[/url] doc: [url=http://pinoysmartlife.com/phpmailer-plugin-for-codeigniter/112/]Pinoy Smart Life[/url] The original PHPMailer package [url=http://phpmailer.codeworxtech.com/]http://phpmailer.codeworxtech.com/[/url][/b]

phpmailer_pi.php

[code] <?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';
}

} ?> [/code] From the controller:

[code] <?php public function forgot_password() { $this->load->plugin('phpmailer'); send_mail('[email protected]', '[email protected]', 'subject', 'message body'); }

?> [/code]

Clone this wiki locally