Jump to content

can't connect to gmail with SMTP SSL connection


INTPnerd

Recommended Posts

I am trying to send emails from php using a hosted gmail account.  I have PHP Version 4.3.1.0 and Apache version 2.0.55 running on Windows.  Based on code examples and information I found from other sites it seems that the only way to do this is with a SMTP SSL connection.  I tried using the Swift mailing library, but I could not get a connection.  I also tried a modified PHPMailer library which has a PHPGMailer class : http://www.vulgarisoip.com/?p=17

 

This is the code that I tried with the PHPGMailer class:

 

require_once('/www/phpHelpers/phpgmailer/class.phpgmailer.php');

$mail = new PHPGMailer();

$mail->Username = ' ****@*****.com';

$mail->Password = '********';

$mail->From = '****@*****.com'';

$mail->FromName = 'First Last';

$mail->Subject = 'email test';

$mail->AddAddress('*****@hotmail.com');

$mail->Body = 'Hey buddy, here is an email!';

$mail->Send();

 

I got these errors:

 

PHP Warning:  fsockopen(): no SSL support in this build in C:\www\phpHelpers\phpgmailer\class.smtp.php on line 105

 

PHP Warning:  fsockopen(): unable to connect to smtp.gmail.com:465 in C:\www\phpHelpers\phpgmailer\class.smtp.php on line 105

 

It seems that I would need to have SSL installed on the server for this to work.  I was wondering if I already had this installed, so I ran phpInfo() and it does not say anything about ssl under PHP Version or under Configuration PHP Core.  However, under apache2handler it says the apache version is:

Apache/2.0.55 (Win32) mod_ssl/2.0.55 OpenSSL/0.9.8a PHP/4.3.10

 

On the php.net website under the manual it has a section on OpenSSL Functions and under installation it says:

To use PHP's OpenSSL support you must also compile PHP --with-openssl[=DIR].

 

Is this what I need?  How can I tell if the version of php I have installed is already supporting OpenSSL?  When it says you have to compile php with --openssl[=DIR] does that mean that I would need to download the php souce code and compile it myselft using a special option?  If so, how would I go about compiling it?

Any help will be greatly appreciated!

Link to comment
Share on other sites

Hi!

 

I don't understand your question, but if you want to send email to gmail account, why don't you use mail()? It will send mail everywhere you want, and you can add the "From" header, where you can write down your email address to which they can reply to you.

 

 

All the best,

Adika

 

Link to comment
Share on other sites

Hi Adika.  I don't want to send an email to a gmail account, I want to send an email from a gmail account.  This requires a secureed SSL SMTP connection.  I need to know if this requires me to install ssl on my end and how I should do this.

Link to comment
Share on other sites

Sorry, but I don't get it!

 

I see that with that script, you can send mail from PHP. But, why do you need a Gmail account? Do you want to send an email from your site, and the receiver will see your gmail address and reply to that?

 

Link to comment
Share on other sites

Yes.  Basically I just want to be able to send automated emails from our company, and have replies sent to my gmail address.  We are using hosted GMail accounts in the form of username@domainname.com.  We access our email on the web using the standard gmail web interface, except we go to mail.domainname.com to login

Link to comment
Share on other sites

SSL in Apache is different from SSL in PHP. Did you read the page that you posted??

 

Note to Win32 Users:  In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: libeay32.dll 

 

So, you need to install SSL under Windows and be sure the DLL's are in your path. No clue how to do this since I work in Linux.

Link to comment
Share on other sites

SSL in Apache is different from SSL in PHP. Did you read the page that you posted??

 

Note to Win32 Users:  In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: libeay32.dll 

 

So, you need to install SSL under Windows and be sure the DLL's are in your path. No clue how to do this since I work in Linux.

 

I already did that...

Link to comment
Share on other sites

Here is a recap of the actual questions I was asking:

 

Is this(this being installing OpenSSL and following the instructions found here: http://us2.php.net/openssl) what I need?  How can I tell if the version of php I have installed is already supporting OpenSSL?  When it(http://us2.php.net/openssl) says you have to compile php with --openssl[=DIR] does that mean that I would need to download the php souce code and compile it myselft using a special option?  If so, how would I go about compiling it with that option?

Any help will be greatly appreciated!

Link to comment
Share on other sites

  • 4 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.