Solved

php mailer

Posted on 2011-09-23
2
380 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

628 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