Link to home
Start Free TrialLog in
Avatar of javiermorquecho
javiermorquechoFlag for Mexico

asked on

phpMailer in hostmonster doesn´t connect...What fails?

Hi Experts!

I waste to many time trying to resolve a problem with my phpMailer configuration. I ´ve a hostmonster hosting and in forums I ´ve seen that is OK sending email, but, to me is n´t.

The configuration that I added is:
$mail->Host      = "mail.website.com";
	$mail->Mailer    = "smtp";
	$mail->Port      = 26;                   //25 isnot
	$mail->SMTPAuth  = true;
	$mail->Username   = "info@website.com"; 		// SMTP account username
	$mail->Password   = "XXXXXXX";        			// SMTP account password

Open in new window

Avatar of ycTIN
ycTIN
Flag of Hong Kong image

please see the correct example here:
http://phpmailer.codeworxtech.com/index.php?pg=examples

following code is send demo mail via SMTP Server

<?php
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
 
$mail             = new PHPMailer();
 
$body             = "Hello";
 
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "mail.yourdomain.com"; // sets the SMTP server
$mail->Port       = 26;                    // set the SMTP port for the GMAIL server
$mail->Username   = "yourname@yourdomain"; // SMTP account username
$mail->Password   = "yourpassword";        // SMTP account password
 
$mail->SetFrom('name@yourdomain.com', 'First Last');
 
$mail->AddReplyTo("name@yourdomain.com","First Last");
 
$mail->Subject    = "PHPMailer Test Subject via smtp, basic with authentication";
 
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
 
$mail->MsgHTML($body);
 
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
 
 
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
?>

Open in new window

Avatar of javiermorquecho

ASKER

Hi ycTIN!

I will try!

Thnx
ASKER CERTIFIED SOLUTION
Avatar of nplib
nplib
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi plib!

I will try it!

Thnx
Thnx nplib, you´re right!!!