<?php
	require("smtp.php");
	require("sasl/sasl.php");
	
	$from="
[email protected]";    $sender_line=__LINE__;
	$to="
[email protected]";    $recipient_line=__LINE__;
	if(strlen($from)==0)
		die("Please set the messages sender address in line ".$sender_line." of the script ".basename(__FILE__)."\n");
	if(strlen($to)==0)
		die("Please set the messages recipient address in line ".$recipient_line." of the script ".basename(__FILE__)."\n");
	$smtp=new smtp_class;
	$smtp->host_name="smtp.gmail.com";  
	$smtp->host_port=465;        
	$smtp->ssl=1;                  
	$smtp->http_proxy_host_name='';  
	$smtp->http_proxy_host_port=3128;
	$smtp->socks_host_name = '';   
	$smtp->socks_host_port = 1080;     
	$smtp->socks_version = '5';        
	$smtp->start_tls=0;              
	$smtp->localhost="localhost";
	$smtp->direct_delivery=0;       
	$smtp->timeout=30;           
	$smtp->data_timeout=0;    
	$smtp->debug=1;   
	$smtp->html_debug=1;       
	$smtp->pop3_auth_host="";        
	$smtp->user="
[email protected]";   
	$smtp->realm="";                    
	$smtp->password="xxxxxxxxxx";
	$smtp->workstation="";
	$smtp->authentication_mechanism="";
	if($smtp->direct_delivery)
	{
		if(!function_exists("GetMXRR"))
		{
			$_NAMESERVERS=array();
			include("getmxrr.php");
		}
	}
	if($smtp->SendMessage(
		$from,
		array(
			$to
		),
		array(
			"From: $from",
			"To: $to",
			"Subject: Testing Manuel Lemos' SMTP class",
			"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
		),
		"Hello $to,\n\nIt is just to let you know that your SMTP class is working just fine.\n\nBye.\n"))
		echo "Message sent to $to OK.\n";
	else
		echo "Could not send the message to $to.\nError: ".$smtp->error."\n";
?>
This code works fine when I send mail from my local computer (XAMPP) but when I upload it to my domain, connection just times out and program haults.
Where am I doing it wrong?