CHANDRA SEKHAR
2015-06-02 18:20:57 UTC
Hello everyone,
I am using Apache HTTP Server 2.4 as the web server and PHP version 5.5 My
machine is using Windows 7 enterprise edition which comes with
a Windows firewall. I am using Microsoft live essentails for anti-virus.
Thus I am using external SMTP server. I don't have IIS
installed in my computer nor do I have an SMTP server running.
I tried the PHP's mail(...) function but the function fails. It reports 1.SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (41609424)
2.The following From address failed: ***@divyasthali.org : Called Mail() without being connected Mail error: The following From address failed: ***@divyasthali.org : Called Mail() without being connected I searched the entire php.net sites but the exact
problem is not faced by anyone. ICould the incompatibility between Apache and PHP causing this?
Any help would be appreciated very much
it is the program
<?php
require_once('../class.phpmailer.php');
//include_once($_SERVER["DOCUMENT_ROOT"]."phpmailer/class.phpmailer.php")
define('GUSER', '***@divyasthali.org'); // GMail username
define('GPWD', '#######');
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->SetLanguage('en');
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
if (smtpmailer('***@gmail.com', '***@divyasthali.org', 'phani', 'test mail message', 'Hello World!')) {
// do something
}
if (!empty($error)) echo $error;
?>
Any help would be appreciated very much
Regards
Chandrasekhar
8688249368
I am using Apache HTTP Server 2.4 as the web server and PHP version 5.5 My
machine is using Windows 7 enterprise edition which comes with
a Windows firewall. I am using Microsoft live essentails for anti-virus.
Thus I am using external SMTP server. I don't have IIS
installed in my computer nor do I have an SMTP server running.
I tried the PHP's mail(...) function but the function fails. It reports 1.SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (41609424)
2.The following From address failed: ***@divyasthali.org : Called Mail() without being connected Mail error: The following From address failed: ***@divyasthali.org : Called Mail() without being connected I searched the entire php.net sites but the exact
problem is not faced by anyone. ICould the incompatibility between Apache and PHP causing this?
Any help would be appreciated very much
it is the program
<?php
require_once('../class.phpmailer.php');
//include_once($_SERVER["DOCUMENT_ROOT"]."phpmailer/class.phpmailer.php")
define('GUSER', '***@divyasthali.org'); // GMail username
define('GPWD', '#######');
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->SetLanguage('en');
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
if (smtpmailer('***@gmail.com', '***@divyasthali.org', 'phani', 'test mail message', 'Hello World!')) {
// do something
}
if (!empty($error)) echo $error;
?>
Any help would be appreciated very much
Regards
Chandrasekhar
8688249368