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
PHP Cannot redeclare class
I have 6 files, and two of them do not seem to want to play well. I keep getting a "Cannot rede
PHP/PKI
I am trying to set up a web application that uses pki. does anyone have a good tutorial to set this
Display thumbnails as square while retaining aspect ratio
I am trying to figure out a way to make an image display as a square, for example 80x80 pixels, when
New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan
Limiting checkboxes?
Hi guys,
I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec
IIS & NW MII on the same server
Hi,
We're weighing the possibility to run both IIS and MII (NetWeaver) on the same server
update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an
Using CSS to format MySQL query
Hi,
If i want to have a news page on my site, which displays all records of a table in descen
what business processes?
Hi,
A general question. What business processes (like OTC - Order to Cach, P2P, R2R etc)
strptime() equivalent for php4 ?!
Greetings!
this is my first post, thank you in advance for your replies.
Well, the ti