satsujin
08-01-2008, 11:20 AM
Hi folks,
I keep getting the following message when I try to run a php script trying to send email through gmail:
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\phpmailer\class.smtp.php on line 124
Mailer Error: SMTP Error: Could not connect to SMTP host.
The common solution on the web seems to be to uncomment the php_openssl.dll extension in php.ini but I've already done that and restarted my Apche webserver with no luck. I should add that stream_get_transports() only returns tcp and udp. Can someone please help? Here is the PHP script I'm using:
include("C:\phpmailer\class.phpmailer.php");
$mail= new PHPMailer();
$mail->Mailer="smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "satsujin@gmail.com"; // SMTP username
$mail->Password = "passwd"; // SMTP password
$webmaster_email = "satsujin@gmail.com"; //Reply to this email ID
$email="anoopm@shabiagroup.com"; // Recipients email ID
$name="AnoopM"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Satsujin";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
I keep getting the following message when I try to run a php script trying to send email through gmail:
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\phpmailer\class.smtp.php on line 124
Mailer Error: SMTP Error: Could not connect to SMTP host.
The common solution on the web seems to be to uncomment the php_openssl.dll extension in php.ini but I've already done that and restarted my Apche webserver with no luck. I should add that stream_get_transports() only returns tcp and udp. Can someone please help? Here is the PHP script I'm using:
include("C:\phpmailer\class.phpmailer.php");
$mail= new PHPMailer();
$mail->Mailer="smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "satsujin@gmail.com"; // SMTP username
$mail->Password = "passwd"; // SMTP password
$webmaster_email = "satsujin@gmail.com"; //Reply to this email ID
$email="anoopm@shabiagroup.com"; // Recipients email ID
$name="AnoopM"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Satsujin";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}