views:

1168

answers:

2
+3  A: 

You PHP installation (XAMPP, by the looks of it) does not support SSL. Ensure that the line

extension=php_openssl.dll

is not commented out in your php.ini, restart Apache, and if that still doesn't work try overwriting (or copying) ssleay32.dll and libeay32.dll from your PHP directory into Apache's binary (.exe) directory then restart Apache.

Mihai Limbășan
+3  A: 

First of all when you get error messages then that's great! Because in 90% of the cases you find that others have had them too and therefore you'll find plenty of information on the internet about this error message.

So step 1 when getting an error message you don't know yet is always open google and copy paste it there. But, take out any paths or other things which are uniquely connected to your system.

Then about your errors. Especially xampp light doesn't support SSL. Maybe you try an easier sendmail example first. Like a very small one and then increase it step by step. That's what I always do, when I don't know why something doesn't work. I start with one line and see what it does, then I add another and so forth.

Let's say you start with this and see if it works:

<?php

include("class.phpmailer.php");

$mail             = new PHPMailer();

$mail->IsSMTP();
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "[email protected]";  // GMAIL username
$mail->Password   = "xxxxxxxx";            // GMAIL password

$mail->From       = "[email protected]";
$mail->Subject    = "PHPMailer Test Subject via gmail";
$mail->Body       = "Hi, this is a test";           
$mail->AddAddress("[email protected]", "Hussain");

$mail->send();
?>

oh, and btw. your mail from has a .com too many!

tharkun
I tried to run your code and it gave me no error but i didnt get any mail as well. where can I check is there any Queue Folder in xampp where we can check either code its working or not such like we have in IIS. Thanks for your very helpful reply please guide me further thanks.
Talha Bin Shakir
do you have a hosting somewhere? where you could test the code online...xampp comes with Mercury (Mail Server) I don't know about the lite version. I normally use Mercury and just forward everything to tester@localhost for which I create a pop account in my e-mail client.
tharkun
no actually i dont have any hosting. Then How to know?? Any way Thanks alot for your help i will check if couldnt get then will get back to you.
Talha Bin Shakir
of course it depends on your provenance what's cheap and what's not but shared hosting accounts are considered extremely cheap! if you're serious with learning PHP and the like you should consider getting one of those for a starter!
tharkun