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();
Did you know?Explore Trending and Topic pages for more stories like this.
$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 Like 46 Dislike
Previous forums Next forums
Other forums

Header redirect
Hello ive got a problem ive got form with its action set to itself.
Code: <form id="f

How to display random record from table?
I have the following code:

Code: <?php
$display_block .= "<input type=

$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown

PHP and Javascript
Hello Everyone,

I have a page that needs a javascript code to be written between PHP code but

Remove directories not empty
hi,
i have an array that contains some names (1,4,6,56...). Every integer is a name of a folder.<

Javascript using window.location seems to lose state
Not sure what forum so let me know if I'm in the wrong place. I have a main window with a ajax grid

Mysql query, two times?
Hello to all,

I'm new to php coding and i like it alot. I need help with some noob stuff.

Where is my php.ini???
Hi

First off - apologies - i'm not a coder so this may sound very amateur.

I'm having

error help - Dynamic Image
I've been working on making my site less cluttered in the directories and more secure lately. In an

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash