Solved

php mailer

Posted on 2011-09-23
2
371 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
2 Comments
 
LVL 83

Accepted Solution

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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configuring a checkbox in CSS and php 18 88
Wordpress errors showing up, hacked? 4 33
php extract($_REQUEST) 5 46
How is this connection happening? 3 10
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 …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

785 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