INTPnerd Posted March 2, 2007 Share Posted March 2, 2007 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! Quote Link to comment Share on other sites More sharing options...
Adika Posted March 2, 2007 Share Posted March 2, 2007 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 Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 2, 2007 Author Share Posted March 2, 2007 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. Quote Link to comment Share on other sites More sharing options...
Adika Posted March 2, 2007 Share Posted March 2, 2007 Wait! You want to send a mail from a gmail account? Why don't you just log in to your account and send a mail from there? Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 2, 2007 Author Share Posted March 2, 2007 This should give you a better idea of what I am trying to do: http://www.vulgarisoip.com/?p=17 Quote Link to comment Share on other sites More sharing options...
Adika Posted March 2, 2007 Share Posted March 2, 2007 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? Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 2, 2007 Author Share Posted March 2, 2007 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 Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 2, 2007 Author Share Posted March 2, 2007 Anyway, you don't really need to understand why I am trying to do this. I just need help doing it. I am unsure as to whether i need to use a custom compiled version of php to support ssl like it says here: http://us2.php.net/openssl Quote Link to comment Share on other sites More sharing options...
linuxdream Posted March 2, 2007 Share Posted March 2, 2007 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. Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 3, 2007 Author Share Posted March 3, 2007 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... Quote Link to comment Share on other sites More sharing options...
INTPnerd Posted March 8, 2007 Author Share Posted March 8, 2007 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! Quote Link to comment Share on other sites More sharing options...
xckon Posted April 5, 2007 Share Posted April 5, 2007 i recomend you to use PHPMailer, it works for me, but for use it you will have to enable : php_openssl.dll in your php.ini: ";extension=php_openssl.dll" => "extension=php_openssl.dll" Quote Link to comment Share on other sites More sharing options...
mattd8752 Posted April 5, 2007 Share Posted April 5, 2007 It might be easier to show reply-to and send from a noreply@yourdomain.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.