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
problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according t
path to include folder
Hi everyone,
When I'm testing locally, I have to add the name of the site folder as part of t
Procedural to OOP
John Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pr
b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)
Images outside webroot
Im hopeing someone can help me with this because i cant figure it out.I have setup an ASP.NET websit
$_FILES array
Ok,
I just started experimenting with PHP today. My goal right now is to have people be able
Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like
I would like "for" to wait 5 sec
I would like my 'for' loop to wait 5 sec before second iteration.
for ($i=0; $i<10
DELETE rows based on content
I have a link in my rows
$bit="http://bit.ly/abcd";
$query = mysql_query("D
Error in query: Resource id #4??
hey guys, having a minor (i think) problem here that i havent been able to figure out. long story sh