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
257 Like 54 Dislike
Previous forums Next forums
Other forums

Unable to retreve the values from Mysql Query
Hi,

Here is the php code that I have, Query is running properly in phpmyadmin and is resu

get font info from a font file
hello,

Does anyone know how to get font info from a font file ... using php of course !
<

Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is

Inserting the current date/time while submitting the forum
What do I need to add below to update the current date/time? I have a field in the database called d

How to make a mail Form secure?
I want to create an email Form on my web site. How can I make the Form secure so the submitted info

batch file not building to webapps folder
Hello. I just started running Vista :P and can't seem to get my projects deployed. I found out how

Lack of simpleXML Documentation
What is up with this.

Look at: http://www.php.net/manual/en/function.simplexml-load-file.php<

Splitting Attributes
SQL> SELECT I_NAME, substr(I_NAME,1,instr(I_NAME,'O')) "First part",

substr(I_NAME, IN

Using system() and bringing back the results
I am aware that you can use system() within PHP to execute system commands, but I was wondering if t

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

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