Hi all ,
I have written code for sending mail with pdf file as attachment , but mail sending is not working. I used class.phpmailer.php. The files are attached herewith . Please kindly see if any solution is possible . Hence appreciated.
//$mailpdf=$pdf->Output('exam_schedule.pdf', 'I');
require_once('class.phpmailer.php');
require_once('class.smtp.php');
$mail= new PHPMailer(); // defaults to using php "mail()"
$mail->IsSMTP();
$mail->Host = "blahblah.com";
$mail->SMTPAuth = true;
$mail->Username = 'bumblebee.com';
$mail->Password = '254890567';
$body = $file; //pdf file from any folder
//$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("blah.com","First Last");
$mail->SetFrom('bluedemon.com', 'First Last');
$mail->AddReplyTo("macau.com","First Last");
$address = "no_reply@boo.com";
$mail->AddAddress($address);
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAttachment("pdf/ex1.gif"); // attachment
$mail->AddAttachment("pdf/ex2.gif"); // attachment
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
The class.phpmailer.php file is as follows:
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.0.0
* Version 5.2.7
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/
* @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2013 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
?>