Jump to content

phpMailer fsockopen()


afrc

Recommended Posts

Hi,

 

I'm running a script that uses phpMailer, and it alaways worked with no problems.

Last Friday, i began to experience errors, nothing was changed, nor the script, nor the server configuration files.

 

Server is a (dv) from media temple, i already contacted them, and they gave an exceptional support but couldn't figured this out.

 

The thing is: i'm running the php files on the (dv) server, but the SMTP account i'm authenticating is from other server. This SMTP account is just fine, the problem is where the files are running from.

 

If i change the SMTP account to an e-mail account of the same server, it works perfectly, the problem is i can't authenticate anymore to a external SMTP account.

 

The errors im' getting:

 

Warning: fsockopen() [function.fsockopen]: SSL: connection timeout in /var/www/vhosts/***DOMAIN HIDDEN***/httpdocs/class/mail/class.smtp.php on line 122

 

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in /var/www/vhosts/***DOMAIN HIDDEN***/httpdocs/class/mail/class.smtp.php on line 122

 

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://***DOMAIN HIDDEN***:465 (Unknown error) in /var/www/vhosts/***DOMAIN HIDDEN***/httpdocs/class/mail/class.smtp.php on line 122

 

Mailer Error: SMTP Error: Could not connect to SMTP host.

 

Keep in mind, it is not the port, nor the SMTP account nor the php files, everything worked for long time until friday, it has to be related to the server.

 

I tried turn off the SSL, turned it on, nothing worked.

 

Line 122, file class.smtp.php:

 

/* connect to the smtp server */
    $this->smtp_conn = fsockopen($host,    // the host of the server
                                 $port,    // the port to use
                                 $errno,   // error number if any
                                 $errstr,  // error message if any
                                 $tval);   // give up after ? secs
    /* verify we connected properly */

 

The script i'm running that outputs the errors:

 

include("class/mail/class.phpmailer.php");
include("class/mail/class.smtp.php"); 

$mail             = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth   = true;                 
$mail->SMTPSecure = "ssl";                
$mail->Host       = "***HIDDEN***";      
$mail->Port       = 465;                 
$mail->Username   = "***HIDDEN***";  
$mail->Password   = "***HIDDEN***";            
$mail->AddReplyTo("***HIDDEN***","Name");
$mail->From       = "***HIDDEN***";
$mail->FromName   = "Name";
$mail->Subject = 'Test';

$body = "Hi,<br>This is the HTML BODY<br>";                     
$body = eregi_replace("[\]",'',$body);
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML('Testing ...');
$mail->AltBody = " ALT "; // optional, comment out and test
$mail->AddAttachment("images/2a.jpg");
$mail->AddAddress("***HIDDEN***", "Test");

$mail->IsHTML(true); // send as HTML

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

$mail->ClearAddresses();
$mail->ClearAttachments();

 

Thanks in advance,

Andre

Link to comment
https://forums.phpfreaks.com/topic/208987-phpmailer-fsockopen/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.