I'm trying to send an HTML email. I had to reinstall my php/appache/mysql (AppServ)and had now this isn't working. I downloaded the PHPMailer but I am a little confused on how they want me to edit my php.ini.
Am I supposed to add the class.phpmailer.php file to the directory that is in my path in my php.ini file OR add class.phpmailer.php to the entry in my php.ini file.
example:
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\AppServ\php\class.phpmailer.php;"
OR
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\AppServ\php\"
(and put the class.phpmailer.php file in the c:\appserv\php directory)
I tried both and niether worked.
Here is my error:
Message could not be sent.
Mailer Error: Language string failed to load: provide_address
Here is my code:
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "170.190.xxx.xxx"; // specify main and backup server
$mail->SMTPAuth = false; // turn on SMTP authentication
//$mail->Username = "username"; // SMTP username
//$mail->Password = "password"; // SMTP password
$mail->From = "acme@acme.com";
$mail->FromName = "Acme";
$mail->AddAddress = ("acme.test@acme.com");
//$mail->AddAddress("ellen@example.com"); // name is optional
$mail->AddReplyTo = ("acme.test@acme.com");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "<table width='736' height='509' border='1' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#26354A'>
<tr>
<th colspan='2' scope='col'><table width='100%' height='509' border='0' cellpadding='0' cellspacing='0' bgcolor='#D3DCE6'>
<tr>
<th width='230' rowspan='2' align='left' valign='top' bgcolor='#26354A' scope='col'><img src=' width='230' height='286' /></th>
<th width='500' height='19' scope='col'> </th>
</tr>
<tr>
<td height='176' align='left' valign='top'><blockquote>
<p class='style1'>You have a message. </p>
<p class='style1'>Please login to view your requests.</p>
<p class='style2'><a href=' Here to Login </a></p>
</blockquote> </td>
</tr>
<tr>
<th bgcolor='#26354A' scope='row'> </th>
<td> </td>
</tr>
</table></th>
</tr>
</table>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
?>
Am I supposed to add the class.phpmailer.php file to the directory that is in my path in my php.ini file OR add class.phpmailer.php to the entry in my php.ini file.
example:
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\AppServ\php\class.phpmailer.php;"
OR
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\AppServ\php\"
(and put the class.phpmailer.php file in the c:\appserv\php directory)
I tried both and niether worked.
Here is my error:
Message could not be sent.
Mailer Error: Language string failed to load: provide_address
Here is my code:
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "170.190.xxx.xxx"; // specify main and backup server
$mail->SMTPAuth = false; // turn on SMTP authentication
//$mail->Username = "username"; // SMTP username
//$mail->Password = "password"; // SMTP password
$mail->From = "acme@acme.com";
$mail->FromName = "Acme";
$mail->AddAddress = ("acme.test@acme.com");
//$mail->AddAddress("ellen@example.com"); // name is optional
$mail->AddReplyTo = ("acme.test@acme.com");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "<table width='736' height='509' border='1' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#26354A'>
<tr>
<th colspan='2' scope='col'><table width='100%' height='509' border='0' cellpadding='0' cellspacing='0' bgcolor='#D3DCE6'>
<tr>
<th width='230' rowspan='2' align='left' valign='top' bgcolor='#26354A' scope='col'><img src=' width='230' height='286' /></th>
<th width='500' height='19' scope='col'> </th>
</tr>
<tr>
<td height='176' align='left' valign='top'><blockquote>
<p class='style1'>You have a message. </p>
<p class='style1'>Please login to view your requests.</p>
<p class='style2'><a href=' Here to Login </a></p>
</blockquote> </td>
</tr>
<tr>
<th bgcolor='#26354A' scope='row'> </th>
<td> </td>
</tr>
</table></th>
</tr>
</table>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
?>