Solved

php mailer

Posted on 2011-09-23
2
377 Views
Last Modified: 2012-05-12
SMTP Error: Could not connect to SMTP host. Message was not sent
Mailer Error: SMTP Error: Could not connect to SMTP host.

even though it was working a month ago ..
i am using gmail account with the phpmailer .
i am going crazy , all of the sudden something happened and made this not working ..
any ideas ?!


here is the php code :
<?php
require("class.phpmailer.php");


$name = "Tester";
$nameMail ="DummyText";

$body ="helllllo";
$sub ="New Assignment";
$address ="abc@hotmail.com";

$mailer = new PHPMailer();
$mailer->Mailer = 'smtp';

$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->Port = 465;

$mailer->SMTPSecure='ssl';
$mailer->SMTPAuth = true;
$mailer->SMTPKeepAlive = true;
$mailer->Host = 'smtp.gmail.com';






$mailer->Username = 'mymail@gmail.com';  // Change this to your gmail adress
$mailer->Password = '123456';  // Change this to your gmail password
$mailer->From = $nameMail;  // This HAVE TO be your gmail adress
$mailer->FromName = $name; // This is the from name in the email, you can put anything you like here
$mailer->Body = $body ;
$mailer->Subject = $sub;
$mailer->AddAddress($address);  // This is where you put the email adress of the person you want to mail
if(!$mailer->Send())
{
   echo "Message was not sent<br/ >";
   echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
   echo "Message has been sent";
}
?>


ofcourse there are the phpmailer class and the smtp class within the same folder .
as i said .. it was working before a short period of time .. but now it is not .
0
Comment
Question by:mokatell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 36590910
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question