Skip to main content

PHPMailer

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php

require_once "class.phpmailer.php";

$mail = new PHPMailer;

$mail->From = "muhammad.kaleem@people.com.pk";
$mail->FromName = "Kaleem People";

$mail->addAddress("muhammad.kaleem@people.com.pk", "Kaleem Add Address Name");

//Provide file path and name of the attachments
//$mail->addAttachment("file.txt", "File.txt");
$mail->addAttachment("file.txt");  
$mail->addAttachment("../images/profile-pic.jpg");
$mail->addAttachment("../report/20090520-074141_sr-march09 dps.pdf"); //Filename is optional

$mail->isHTML(true);

$mail->Subject = "Subject Text Kaleem";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send())
{
    echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
    echo "Message has been sent successfully";
}
?>
</body>
</html>

Comments