|
Posted by Dennis de Wit on 09/01/06 09:22
Mike wrote:
> 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
>
Are you sure that smtp server exists, and is accessible from your
server? Most internet service providers block access to their SMTP
server from outside their network.
Dennis
Navigation:
[Reply to this message]
|