forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
PHPMailer
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
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_mail('[email protected]', '[email protected]', 'subject', 'message body'); }
?>