Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHPMailer debugging (Failed to connect to server)

222 views
Skip to first unread message

jephperro

unread,
Dec 3, 2007, 6:02:35 PM12/3/07
to
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 = "cc...@cccccccc.com"; // $from_email_address;
$mail->AddAddress("cxxcx...@gmail.com", "TEST YOU"); //
($to_email_address, $to_name);

$mail->Send();

NC

unread,
Dec 3, 2007, 6:22:54 PM12/3/07
to
On Dec 3, 3:02 pm, jephperro <jeff.perrea...@gmail.com> 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

jephperro

unread,
Dec 4, 2007, 12:49:51 PM12/4/07
to
Thanks for the help, it turned out that SELinux was preventing a
socket from being opened. My hosting company did the security
settings.

Jeff

0 new messages