You are here: phpmailer error « All PHP « IT news, forums, messages
phpmailer error

Posted by Mike on 09/01/06 08:16

As I have had hosting problems using mail() I'm trying to use
PHPMailer.

I have the following code...

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.mysmtpserver.co.uk"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "myusername"; // SMTP username
$mail->Password = "mypassword"; // SMTP password
$mail->From = "info@mysite.co.uk";
$mail->FromName = "Info";
$mail->AddAddress("mike@anotheraddress.co.uk","Mike");
$mail->AddReplyTo("info@mysite.co.uk","Info");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>

The class.phpmailer.php and class.smtp.php are exactly as downloaded
from sourceforge.

The error I get is...

Warning: fsockopen() [function.fsockopen]: unable to connect to
mail.mysmtpserver.co.uk:25 (Connection refused) in /class.smtp.php on
line 105
Message was not sent
Mailer Error: SMTP Error: Could not connect to SMTP host.

Now I'm guessing this looks like the SMTP host, username or password
may be at fault, although I have triple checked this.

Any ideas??

Thanks

Mike

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация