<?php
/*
* Created on May 19, 2008
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
class Action extends Controller {
function Action()
{
parent::Controller();
}
function testMailer()
{
error_reporting(E_ERROR);
$this->load->plugin('phpmailer');
$mail=new PHPMailer();
/*$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "username@somedomain.com"; // GMAIL username
$mail->Password = "xxxxxx"; // GMAIL password
*/
$mail->From = "username@somedomain.com";
$mail->FromName = "sender name";
$mail->Subject = "This is the subject";
$mail->Body = "Hi,This is the HTML BODY"; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
//print_r($mail);
$mail->WordWrap = 50; // set word wrap
$mail->AddAddress("someone@somedomain.com");
$mail->AddReplyTo("username@somedomain.com","sender name");
$mail->AddAttachment("/path/to/file.zip"); // attachment
$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
}
}
?>
http://www.lavluda.com/2008/05/19/phpmailer-for-codeigniter-ci/
Leave a Reply