phpMailer will not connect using SMTP
Posted on
16th Feb 2014 07:03 pm by
admin
I am trying to use phpMailer with smtp:
Code: [Select]$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Mailer = "smtp";
$mailer->SMTPSecure = 'tls';
$mailer->Host = 'smtp.orangehome.co.uk';
$mailer->Port = 25;
$mailer->SMTPAuth = false;
$mailer->Username = 'mail@domain.com';
$mailer->Password = 'password';
$mailer->From = 'mail@domain.com';
$mailer->FromName = 'Me';
$mailer->Body = 'This is the main body of the email';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress('you@domain.com');
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
echo "Message has been sent";
}
I have also tried with googlemail:
Code: [Select]$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Mailer = "smtp";
$mailer->SMTPSecure = 'ssl';
$mailer->Host = 'smtp.gmail.com';
$mailer->Port = 465;
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'mail@domain.com';
$mailer->Password = 'password';
$mailer->From = 'mail@domain.com';
$mailer->FromName = 'Me';
$mailer->Body = 'This is the main body of the email';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress('you@domain.com');
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
echo "Message has been sent";
}
but I get this error message:
Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.orangehome.co.uk:25 (Connection timed out) ...
or the equivalent for gmail
Is there something I'm missing?
PHP Version 5.2.6
PHPMailer - PHP email class Version: 2.3
No comments posted yet
Your Answer:
Login to answer
254
46
Other forums
Unable to customise toolbar in FCK
PHP and Javascript
Hello Everyone,
I have a page that needs a javascript code to be written between PHP code but
Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?
class MyApp
{
md5 is it unique
I know this is most likely one of many simple questions that can be found semi easily. But I'm press
Adding to an Int row in db
Hi, i have a database which houses all of the users of my site. One of the columns is for points whi
foreach and array need help combining
Hi guys.
Here's the code
Code: array(
'tag' => 'code',<
Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th
Simpler method of getting variables from mysql
Hi Guys,
I'm trying to streamline my CMS's code and as I was writing a new page it occured to
parameter passing issue on function
Well I thought I had created a pretty slick web page, using ?page and $_GET to load pages which wher
Using Windows message as a Handle
Hi,
I am writing one of my first multithreaded programs.
In one of the thread,