Error in mail sending

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asmitacp
Forum Newbie
Posts: 16
Joined: Wed Mar 26, 2008 7:36 am

Error in mail sending

Post by asmitacp »

I am using following code to send mail.

1. require_once('class.phpmailer.php');
2.
3. $msg = new PHPMailer();
4.
5. $msg->IsSMTP();
6. $msg->Host = "ssl://smtp.gmail.com:465";
7. $msg->SMTPAuth = true;
8. $msg->Username = 'username@mail.com';
9. $msg->Password = 'password';
10.
11. $msg->From = 'john@example.com';
12. $msg->FromName = 'John Doe';
13. $msg->AddAddress('cindy@somewhere.com');
14. $msg->Subject = 'Testing';
15. $msg->Body = 'Hello there';
16. $msg->Sender = $msg->From; // for Return-path
17.
18. if (!$msg->Send()) die('epic fail...');


But it sends error that could not connect to smpt.
Post Reply