-
Notifications
You must be signed in to change notification settings - Fork 7.6k
PHPMailer
Derek Jones 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
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
<?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('[email protected]', '[email protected]', 'subject', 'message body');
}
?>