Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why am I getting this error???

Status
Not open for further replies.

sd0t1

IS-IT--Management
Mar 14, 2007
131
US
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'>&nbsp;</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'>&nbsp;</th>
<td>&nbsp;</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;
}



?>
 
remember that if you change the php.ini file you need to restart the webserver afterwards.

the second example of the change is the correct version. you must point to a directory, not a file.

in the alternative you can put the following at the top of your file

Code:
ini_set('include_path',".;c:/php/includes;c:/AppServ/php/"

note that you must incude all the files and plugins in this directory (/appserv/php
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top