Fatal error occuerred ?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Fatal error occuerred ?

Post by geddi »

Hello,

I just ran some tests and keep getting fatal errors.

This one:
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [tls://smtp.gmail.com:465]: fsockopen returned Error Number 110 and Error String 'Connection timed out'' in /home/letsget/public_html/swift_lib/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/letsget/public_html/swift_lib/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/letsget/public_html/swift_lib/Swift.php(101): Swift->connect() #2 /home/letsget/public_html/b_email_act.php(94): Swift->__construct(Object(Swift_Connection_SMTP)) #3 /home/letsget/public_html/index.php(229): require_once('/home/letsget/p...') #4 {main} thrown in /home/letsget/public_html/swift_lib/Swift/Connection/SMTP.php on line 309

I am running:Swift-3.3.2-php5
and the server has php 5.2

my script is:

Code: Select all

<?php 
/* 
*       emailler.php
*
*
*  send WAITING CONFIRMATION email  
*/     
 
/* 
*  make MESSAGE  
*/     
 
require_once("my_functions.php");
 
$messageX = "
<html>
<head>
<title>www.Lets-Get-Started.net</title>
</head>
<body>
<div style = ' 
  width:600px; 
  background-color:white; 
    font-family:Tahoma, Tunga, sans-serif;
    font-size:14;
    text-align:left; 
    font-weight:normal;
    padding:1px;
  margin:1px;
 '>
<p>
<br>
<center><b>Free Entry to the Lets-Get-Started.net Membership site - Confirmation.</b></center>
<br><br>
Dear $N_contact,
<br><br>
Welcome aboard!
<br><br>
Your email and password are recorderd as follows:<br>
Email: $N_email <br>
Password : $N_pass<br>
<br>
Please record your password as you will need it when entering the site.      
<br><br>
Please click on the link below to confirm your free entrance into 'Lets-Get-Started'.
<br><br>
You will be taken directly to the introduction page.
<br><br>
<a href=\"http://www.lets-get-started.net/do_it.php?client=$N_email\">Confirm and enter site.</a>
<br><br>
See you there!
<br><br>
******************<br>
<br><br>
</p>
</div>
</body>
</html>
";
 
 
// Set up correct headers       
 
$to  = $N_email;
 
$from="Dave@lets-get-started.net";
$name="Dave";
 
$headers ="MIME-Version:1.0\r\n";
$headers .="content-type:text/html; Charset=iso-8859-1\r\n";
$headers .= "From: " . "$name" . "<" . "$from" . ">\n";
$headers .= "Return-Path: <" . "$to" . ">\n";
$headers .= "Error-To: <" . "$to" . ">\n";
$headers .= "X-Sender: <" . "$to" . ">\n";
$headers .= "X-Mailer: PHP v".phpversion()."\n";
 
 
// subject
$subject = "As Promised ...Your Free Access to LETS GET STARTED.";
$subject= nl2br($subject);
 
 
// $messageX = "this is a temporary test message";    
 
$message=$messageX;
$message=nl2br($message);
 
 
require_once "swift_lib/Swift.php";
require_once "swift_lib/Swift/Connection/SMTP.php";
 
//Create a Swift instance and connect to Gmail (PHP5)
 $swift = new Swift(new Swift_Connection_SMTP(
    "smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS));
 
 $smtp->setUsername('lets.get.started.net@gmail.com');
 $smtp->setPassword('gpassword');
 $swift =& new Swift($smtp);
 
 
//Create the sender from the details we've been given
 $sender =& new Swift_Address($email, $from);
 
//Create the message to send
 $message =& new Swift_Message($subject);
 $message->attach(new Swift_Message_Part($message, "text/html"));
  
 //Try sending the email
 $sent = $swift->send($message, "$to", $sender);
 
 //Disconnect from SMTP, we're done
 $swift->disconnect();
 
if ($sent)
 {
 echo " GREAT IT WORKED !!! ";
 exit();
 }
 else
 {
 echo " OOPS WE HAVE A PROBLEM !!! ";
 exit();
 } 
 
 
/*   ALL BELOW IS COMMENTED OUT - SO IGNORE !!
*  OLD EMAIL code  
//  mail($to, $subject, $message, $headers) ;
if (mail($to, $subject, $message, $headers)  == false) 
{
 echo "Email failed";
}
 
echo "To: $to, <br>Subject: $subject, <br>Headers: $headers, <br>Message: $message";
 
 
$res = mail("yukseklikler@hotmail.com", "Test php mailer for Lets-Get.net", "Hi,
this message proves that php email scripts are working on the domain Lets-Get.net", "From: root@lets-get-started.net", "root@lets-get-started.net");
 
if($res == 1){
echo "email sent successfully, check email to make sure it was recieved."; } 
 
*/
 
 
?>
 
 
The $header variable is set up but the headers are not used anywhere in the swift.

I should probably include a text verion of the message - but I am not sure how to implement that yet.

My question is - "what have I done wrong, why is it failing" ?

I hope that its a pretty obvious reason.

Thanks
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Fatal error occuerred ?

Post by Zoxive »

Chris Corbyn wrote:Sounds as though your host is blocking connections. This could be via firewall rules or I've also had reports that PhpSuExec can cause issues creating sockets and processes. I'd ask your host if they can shed any light on why you're seeing this.

fsockopen() -- a native PHP function, is not being able to connect (Connection refused).
There are posts weekly like yours with the same server issues.

If you look at the error message your are getting and do some searching will find plenty of others with the same issue.
http://www.google.com/search?q=fsockope ... +out%27%27
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Well it is true that my hosting company has problems with the email.
The said that they had got onto ban lists because some clients were spamming too much.

In fact the whole reason for using Swift coupled with using the gmail smpt is because my host provider can not send out emails.

If I could send emails from my hosting account I would not be trying to use gmail server.

I will ask the host about this "fsockopen() -- a native PHP function, is not being able to connect "
problem.

But using the gmail server should get around this shouldn't it ?

Thanks for your input - any more I can do ?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Fatal error occuerred ?

Post by Chris Corbyn »

Sounds like your host have firewall rules which are preventing the connection for being established. What host are you with?
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Hi Chris,

My host is : http://www.bluethundercomputers.com
They are not a big outfit ( a one-man-band I think). The guy says that he is sorting out another server and will move me over to that - but in a few weeks time. I need to use email before that, so that why I was trying to route through a different mail server.

I ran the url through one of the diagnostic sites that I think I got from your site and to be honest I could not understand the results. It appeared to show that the site was NOT on any blacklist.

Would really appreciate it if you could share any other diagnostic links to check this host out.

Many thanks
Dave
Last edited by geddi on Thu Mar 06, 2008 11:58 pm, edited 1 time in total.
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Hi,

I checked my hosting company using this link:

http://www.robtex.com/dns/bluethundercomputers.com.html

One thing I notice is that under "reverse" it just has a question mark.

Is that a bad sign ?

I can not tell from this if the hosting company is on any ban lists / blacklists
Should I be looking with another tool ?

Thanks for anyt guidance.
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Hello

I have done some more digging :)

Hopefully others may find this useful as well.

I used this tool to get some more info on my host
( the one that dosn't send out my emails :( )

http://openrbl.org/query?72.46.136.34

I then followed a link to here:

http://www.dnsstuff.com/tools/tracert.c ... .46.136.34

Now this is quite interesting - it shows a table with 11 "hops".
I guess this means that the "main" connection to the internet is held by theplanet.com
and it is a static IP on 74.53.59.130

Is it then "routed" through hop # 2, 3, & 4 ?
I am not quite sure what this "hop" relationship means
- can anyone offer some info on this ?

"hop 5" is unknown

Then it goes to nwstdsrj01-ge710.rd.lv.cox.net. is this another host company ?

Then onto ge0502-csr1.lv1.marquisnet.com. om hop # 9

and finally my host :
Destination]server2.bluethundercomputers.com.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Fatal error occuerred ?

Post by Zoxive »

geddi wrote: I guess this means that the "main" connection to the internet is held by theplanet.com
and it is a static IP on 74.53.59.130
Actually theplanet.com (74.53.59.130) is how dnsstuff.com is connected to the internet.
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Ahh Uhh
so ... does that mean that the table is actually a links of the links between
dnsstuff.com and my host "server2.bluethundercomputers.com." ?

Is that right ?


Therefore my host could connect directly
- I dont think so - or maybe via http://www.marquisnet.com. ?

I wonder where ge0502-csr1.lv1.marquisnet.com
and 24-234-18-130.ptp.lvcm.net
and nwstdsrj01-ge710.rd.lv.cox.net
all fit in ??

any ideas ?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Fatal error occuerred ?

Post by Zoxive »

The table link (http://www.dnsstuff.com/tools/tracert.c ... .46.136.34) is just a trace between dnsstuff and your website.

A trace is how one server communicates to the other server, showing all the hops in between. That is what each row in the table is, a hop.
geddi
Forum Commoner
Posts: 39
Joined: Sun Feb 24, 2008 11:01 am

Re: Fatal error occuerred ?

Post by geddi »

Well I looked at http://www.marquisnet.com/
and they seem to be a decent datacenter in Las Vagas.
So it looks like my host leases its server from them.

Would think thats about right ?

I am trying to get to the bottom of the problem of them not being able to send emails.
I thought that if they are just reselling from another hosting co. Thern I would go talk to that company and see what the problem is.

But it looks like my host is a "real host" in that it really does run its own server(s).
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Fatal error occuerred ?

Post by Zoxive »

Either way you can give them a shout, and they can point you in the right direction. :lol:
Post Reply