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
54
Other forums
News script
Hi ...
I am not sure if this is the rite place to post this but if its not sorry
i am
switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to
check how many commas the variable containing the query has between [i]select[/i
Hi...
iv made an sql table that contains id number - name of sql query and an sql query.
T
error reporting
hey everyone
I have a production server in which I want error reporting but only on some page
Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want
Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming
Simultaneous select/update/insert
Hi
How would I need to go about when 2 users update a single row simultaneous? And how would
File upload issues
Hi Guys,
Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages
Mail from PHP form not always ending up in my inbox?
Hi guys,
I'm a real newbie to PHP and have managed to put together a simple mail form that se
Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.
Here is the