PHPMailer debugging (Failed to connect to server)

PHPMailer debugging (Failed to connect to server)

am 04.12.2007 00:02:35 von jeff.perreault

Hi there,

I have a problem using PHPMailer.

On my local development machine, the script works fine and sends
emails.

On amy staging server, when I try to use PHPMailer to send() I see the
error:
SMTP -> ERROR: Failed to connect to server: Permission denied (13)

Can anyone think of why my staging server is preventing my connection
to the external mailserver? Is there a setting in php.ini or apache
that could be preventing this?




Code:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = true;
$mail->SMTPAuth = true;
$mail->Username = "XXXXXXXXXX";
$mail->Password = "XXXXXXXXXXX";
$mail->Host = "21x.xxx.xxx.xxxx";

$mail->Subject = "Test Email"; // $email_subject;
$mail->From = "cccc@cccccccc.com"; // $from_email_address;
$mail->AddAddress("cxxcxxxxcxc@gmail.com", "TEST YOU"); //
($to_email_address, $to_name);

$mail->Send();

Re: PHPMailer debugging (Failed to connect to server)

am 04.12.2007 00:22:54 von nc

On Dec 3, 3:02 pm, jephperro wrote:
> Hi there,
>
> I have a problem using PHPMailer.
>
> On my local development machine, the script works fine and sends
> emails.
>
> On amy staging server, when I try to use PHPMailer to send()
> I see the error:
> SMTP -> ERROR: Failed to connect to server: Permission denied (13)
>
> Can anyone think of why my staging server is preventing my
> connection to the external mailserver?

It could be anything, really... Permission denied (13), if memory
serves, is generated by phpMailer if a call to fsockopen() fails when
trying to establish an SMTP connection. So something is not working
right SMTP-wise between your staging server and your mail server:

1. You staging server (or a router to which it is connected)
may be blocking all outgoing SMTP traffic.
2. Your mail server may be configured to allow SMTP connections
only from certain servers (and your staging server isn't one
of those).

Cheers,
NC

Re: PHPMailer debugging (Failed to connect to server)

am 04.12.2007 18:49:51 von jeff.perreault

Thanks for the help, it turned out that SELinux was preventing a
socket from being opened. My hosting company did the security
settings.

Jeff