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

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

SQL Injection
In my attempts to protect my database from mySQL injection I have created another problem for myself

Comparing Values
Hi
I'm reading data from a database and this seems to work OK.

Each system has an associat

connect() succeeds but accept() does not?
Please help me with this problem. I'm working on a time-sensitive project where I'm using TCP socket

generating all possible random letters
hi'

how can i randomize the letters a,b,c,d,e all possible ways, and i want to print the res

PHP and Javascript
Hello Everyone,

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

Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie

Is there a way to override built in php functions without APD?
I am trying to use the
rename_function()
override_function()
options that are built into

Relative path
I have a absolute path to an image - like so: C:/Program Files/Apache Software Foundation/Apache2.2/

images aren't rendering
I'm trying to call a JPG file from within PHP (in an effort to hide the actual JPG folder). The imag

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