Dear Sir
I am using PHP Mailer for SMTP Authentication, Everything is working fine http://phpmailer.worxware.com/index.php?pg=methods
But AddCC is not working , I am using Windows 2003 Server, and it says this function works with SMTP Mailer , not with the Mail Mailer.
AddCC($address, $name = "")
string $address
string $name
Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
I can't Understand this line : Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
<html>
<head>
<title>PHPMailer - SMTP basic test with authentication</title>
</head>
<body>
<?php
include("config.php");
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
//$body = file_get_contents('contents.php');
//$body = eregi_replace("[\]",'',$body);
$query = "SELECT `SiteId`,`OwnerName`,MONTHNAME(`DurationS`),`pDate` FROM lims_payment WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >30 AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' AND `rDate` LIKE '0000-00-00'
AND rfDate LIKE '0000-00-00'";
$result = @MYSQL_QUERY($query);
$num_rows30p = mysql_num_rows($result); //30+
$query = "SELECT `SiteId`,`OwnerName`,MONTHNAME(`DurationS`),`pDate` FROM lims_payment WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) <=30 AND TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >=22 AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' AND `rDate` LIKE '0000-00-00'
AND rfDate LIKE '0000-00-00'";
$result = @MYSQL_QUERY($query);
$num_rows2230 = mysql_num_rows($result); // 22-30
$query = "SELECT `SiteId`,`OwnerName`,MONTHNAME(`DurationS`),`pDate` FROM lims_payment WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) <=21 AND TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >=15 AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' AND `rDate` LIKE '0000-00-00'
AND rfDate LIKE '0000-00-00'";
$result = @MYSQL_QUERY($query);
$num_rows1521 = mysql_num_rows($result); // 15-21
$query = "SELECT `SiteId`,`OwnerName`,MONTHNAME(`DurationS`),`pDate` FROM lims_payment WHERE TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) <=14 AND TO_DAYS( NOW( ) ) - TO_DAYS( `pDate` ) >=1 AND `cDate` LIKE '0000-00-00' AND `crDate` LIKE '0000-00-00' AND `rDate` LIKE '0000-00-00'
AND rfDate LIKE '0000-00-00'";
$result = @MYSQL_QUERY($query);
$num_rows115 = mysql_num_rows($result); // 1-15
$body = "<html><body style='margin: 10px;'>
<div style='width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;'>
Dear Payable/Finance <br />
Please find the attached sheet of pending payments at your end (starting from 15-21). Following is the summary of attached sheet. <br />
<table border='1' bordercolordark='#000000' cellpadding='10'>
<tr>
<td width='42%' style='background: #eee;'><strong>Total Days</strong></td>
<td width='58%' style='background: #eee;'><strong>No. of Payments</strong></td>
</tr>
<tr>
<td width='42%'>0-14</td>
<td width='58%'>$num_rows115</td>
</tr>
<tr>
<td width='42%'>15-21</td>
<td width='58%'>$num_rows1521</td>
</tr>
<tr>
<td width='42%'>22-30</td>
<td width='58%'>$num_rows2230</td>
</tr>
<tr>
<td width='42%'>30+</td>
<td width='58%'>$num_rows30p</td>
</tr>
</table>
<br />
Engineering Database:<br />
Generated Automatically by Engineering Database<br />
Please, DO NOT Reply to this System Generated Email.<br /></div></body></html>";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "*******"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "********"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "*****"; // SMTP account username
$mail->Password = "*****"; // SMTP account password
$mail->SetFrom('edb@****.com.pk', 'Engineering Databse');
$mail->AddReplyTo("*****@****.com.pk","First Last");
$mail->Subject = "Engineering Database Report";
//$mail->AddEmbeddedImage('phpmailer.gif', 'phpmailer', 'phpmailer.gif '); use this in $body for viewing <img src='cid:phpmailer' alt='phpmailer' />
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress("****@****.com.pk", "Furqan");
$mail->AddCC('****@****.com.pk', 'First Person'); // this not working
$mail->AddAttachment("Excel/LongOutstandings.xlsx"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>