Forum Moderators: coopster

Message Too Old, No Replies

Setting up PHPMailer with gmail

         

matthayzon89

3:40 pm on Dec 12, 2011 (gmt 0)

10+ Year Member



Hello all,
I have been having a lot of trouble trying to set up a PHPMailer with Gmail. I am trying to have a textfeild in my websites where users could e-mail me directly from the website.

I tried different variations of tutorials online with no success. Any help will be greatly appreciated.

This is the error I am currently getting:
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

I am guessing, it may be because I don't have SSL enabled on my server but I am not sure, and if that is the problem, I don't know how to fix it.

I also read somewhere that you can find out a lot of useful information in phpinfo() and I have access to it, but I have yet to find anything to help me solve this problem.


Any help or suggestions, I will greatly appreciate.
Thank you!

matthayzon89

4:14 pm on Dec 12, 2011 (gmt 0)

10+ Year Member



I think I found the problem. I need to enable "extension=php_openssl.dll" in PHP.ini file, and I was able to locate my PHP.ini file, however, I cant seem to figure out how to enable the php_openssl.dll :( Can anyone help?

I tried typing "extension=php_openssl.dll" and ";extension=php_openssl.dll" where all the other .dll extensions files were and it didn't seem like it worked.

penders

4:27 pm on Dec 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you restart PHP / Apache?

matthayzon89

5:08 pm on Dec 12, 2011 (gmt 0)

10+ Year Member



Thanks for the reply. No I did not restart anything yet. I am using XAMPP, so would I need to restart that? Also, me needing to restart my PHP/ Apache means that I enabled the extension in the php.ini file the right way, is that correct?

I tried restarting Apache from my command prompt but it doesn't seem to recognize it as a command. Sorry, all this stuff is very new to me.

penders

5:21 pm on Dec 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need to restart Apache for any changes made to php.ini to have an effect. Usually uncommenting the line in php.ini and restarting Apache is all that's required, since XAMPP comes pre-packaged with a lot of extras.

The command may not be in your PATH?

But if using XAMPP you can do this via the GUI... run the XAMPP Control Panel (xampp-control.exe) then Stop then Start Apache in the dialog.

matthayzon89

6:43 pm on Dec 12, 2011 (gmt 0)

10+ Year Member



I am unable to to Stop Apache from the XAMPP Control Panel. It says Apache is busy/ currently running. I also tried xammp-stop.exe which did not work, probably for the same reason. How would I add the command to my path? I know I need to modify the environment variables in advanced computer properties. Does it need to be a system variable or a user variable and what do I need to set the path and variable name to in order for me to be able to restart Apache from the command prompt?

matthayzon89

1:57 am on Dec 13, 2011 (gmt 0)

10+ Year Member



Problem Solved after restarting Apache.


Just to recap on what I had to do to get this to work if someone else is having the same problem:
1. Download PHPMailer and extract the files into the same directory as your php files

2. (Once your PHPMailer code is working and ready to go) Find your php.ini file and delete the semi colon off of extension=php_openssl.dll, the save.

3. Restart Apache.
NOTE: If you cant restart it using the stop button in xampp-control.exe just click SCM on the xampp control, that will load up all your services, then restart Apache from there.

Thanks for all the help Penders. Once again, I appreciate it:)