Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to send email from phpmailer

11 views
Skip to first unread message

CHANDRA SEKHAR

unread,
Jun 2, 2015, 2:21:55 PM6/2/15
to
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: veda...@divyasthali.org : Called Mail() without being connected Mail error: The following From address failed: veda...@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', 'veda...@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('prakhya....@gmail.com', 'veda...@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

Gordon Burditt

unread,
Jun 2, 2015, 4:11:07 PM6/2/15
to
> 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.

You shouldn't need those if you specify an external SMTP server,
which you did.

> 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)

Answer the question above.

Do you have php_openssl.dll installed in the same directory with
the other extensions? Does this file have permissions that allow
it to be used? Did you uncomment (delete the leading semicolon)
the "extension=php_openssl.dll" line in php.ini? Are you editing
the php.ini that PHP is actually using? You probably have to stop
and restart Apache after any action to fix this problem.

If you can bring up the output of phpinfo() in a web page, look to
see if openssl is enabled. If it's not, fix it. The output of
phpinfo() will also tell you which php.ini file is actually being
used.


> 2.The following From address failed: veda...@divyasthali.org :
> Called Mail() without being connected Mail error: The following
> From address failed: veda...@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?

What incompataility? PHP and Apache aren't supposed to have the
same version number.


If you Google "unable to find the socket transport ssl" you find a lot
of people with similar problems (not all of them are using Mail(); some
of them are using https, but it's the same issue).

If you want to use ssl, you need to install the extension that
provides it. Correctly.

CHANDRA SEKHAR

unread,
Jun 3, 2015, 4:02:55 AM6/3/15
to
1.Do you have php_openssl.dll installed in the same directory
A.Yes the file open_openssl.dll installed in the same directory
2.Did you uncomment (delete the leading semicolon)
the "extension=php_openssl.dll" line in php.ini?
A.Yes i uncommented the leading semicilon
If you can bring up the output of phpinfo() in a web page, look to
see if openssl is enabled. If it's not, fix it. The output of
phpinfo() will also tell you which php.ini file is actually being
used.

extension is properly installed that too not resolves the problem

Regards
Chandu

Jerry Stuckle

unread,
Jun 3, 2015, 9:57:25 AM6/3/15
to
Gordon got the first questions I would have asked. To continue on this
thread, you need to also insure the php_sockets.dll is present and the
respective line in your php.ini file is uncommented. Ensure your
phpinfo() (loaded from the browser) shows both are loaded.


Also, copy ssleay32.dll and libeay32.dll to the main PHP folder, your
Windows folder and the Windows/system32 folder (don't know why you need
it in all three, but that's where I keep them). And ensure all three
are the same version.

If it still doesn't work, in your php.ini file, enable logging errors
all to a file and display_startup_errors:

error_reporting = E ALL
display_errors = on
display_startup_errors = on
log_errors = on
error_log = (the file you want to write the errors to)

Then restart Apache and try again. If it fails, examine the error log
to see what happened.


--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================
0 new messages