Bluehost : Mailer Error: SMTP Error: Could not connect to SMTP host

Sponsors

I am using the bluehost for my some sites hosting. For sending emails I used the SMTP service which is provided by bluehost.

I used the PHPmailer in my website for sending email. When I tried to use the bluehost SMTP I always got the following error message.

Mailer Error: SMTP Error: Could not connect to SMTP host.”

I solved this issue. I created the following function.

<code>

<?php
include(“class.phpmailer.php”);

function mail_new($fun_to,$fun_subject,$fun_body,$fun_header,$fun_from,$fun_cc){
$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = “mail.eparinay.com”;  // specify main and backup server
//$mail->SMTPSecure = “ssl”;                 // sets the prefix to the servier
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = “support@wordpressapi.com”;  // SMTP username
$mail->Password = “YOURPSSSWORD”; // SMTP password
$mail->Port       = 26;

$mail->From = $fun_from;
$mail->FromName = “eparinay.com”;
$mail->AddAddress($fun_to);
$mail->AddReplyTo($fun_from, $fun_from);

if($fun_cc!=”"){
$mail->AddAddress($fun_cc);
}
$mail->WordWrap = 50;                                 // set word wrap to 50 characters
//$mail->AddAttachment(“/var/tmp/file.tar.gz”);         // add attachments
//$mail->AddAttachment(“/tmp/image.jpg”, “new.jpg”);    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = $fun_subject;
$mail->Body    = $fun_body;
//$mail->AltBody = “This is the body in plain text for non-HTML mail clients”;

if(!$mail->Send())
{
echo “Message could not be sent. <p>”;
echo “Mailer Error: ” . $mail->ErrorInfo;
exit;
}
}
?>

</code>

Where you want to use the mail you just need to include the above script and call the “mail_new” function for sending email through bluehost.

Bluehost - Mailer Error- SMTP Error- Could not connect to SMTP host

Bluehost - Mailer Error- SMTP Error- Could not connect to SMTP host

Incoming search terms:

You may like following Articles!

This entry was posted in wordpress and tagged , by Wordpress API. Bookmark the permalink.

About Wordpress API

API means Application Program interface. In Wordpress API we are giving all the information about wordpress API. We worked for many wordpress plugins and themes. We have expertise in PHP, Databases, Graphic Design, Ruby on Rails, Java, Wordpress, Drupal and many CMS. We always give you the best solutions about wordpress and other related topics in This Blog. We will give you always fresh tips and tricks and techniques about wordpress in this blog.

3 thoughts on “Bluehost : Mailer Error: SMTP Error: Could not connect to SMTP host

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>