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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

phpmailer problem

Status
Not open for further replies.

mrsbean

Technical User
Jul 14, 2004
203
US
I'm not sure what I did wrong. It was working earlier, but I inadvertantly changed something which made my php script fail to send the mail anymore.

Here is the screen of the page which shows the error:

Thank you for your inquiry


The following information has been sent to the webmaster:
blank user
Phone: 333-444-5555
Mobile: 2
Fax: 2
E-mail: blank@user.com
Web: blank.com
You wrote: here\'s a blank message

--------------------------------------------------------------------------------

Message was not sentMailer Error: Language string failed to load: recipients_failedmyemail@someserver.com


Here is the code related to the mailer:

require("../phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp-relay.someserver.com"; // SMTP server
$mail->From = "me@someserver.com";
$mail->AddAddress ("myemail@someserver.com");
$mail->username = "myusername"; //username on the relay server
$mail->password = "mypassword"; //password on the relay server

$mail->Subject = "data update";
$mail->Body = $myresult;
$mail->WordWrap = 60;

if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}


Any help is much appreciated.

Linda
 
if yer not doing anything more complex than just sending a message you could use the mail() function built into PHP.

Code:
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])

your script would be then:

*btw i noticed there isnt a "to" address
Code:
$myemail = "me@someserver.com";
$subject = "data update";
$body = $myresult;
$headers = "From: $myemail\r\n";

if(!mail($ToRecicipant, $subject, $body, $headers)
{
   echo "Message was not sent";
}
else
{
   echo "Message has been sent";
}

If you need more information passed with the email you can add more headers as such.

Code:
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: $name <$email>\r\n";
$headers .= "Reply-to: $name <$email>\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP mailer\r\n";


Karl Blessing
PHP/MySQL Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top