Reputation: 1255
I am trying to use php-mailer-class but getting different issue.
Please take a look on my code.
include ("class.phpmailer.php");
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug =1; // debugging: 1 = errors and messages, 2 = messages only
//$mail->SMTPAuth = true; // authentication enabled
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->Username = "admin@****.in";
$mail->Password = "******";
$mail->SetFrom('*****[email protected]', 'User name');
$mail->Subject = 'mailing';
$mail->Body = "<b>Hi, your e- mail has been received.</b>";
$mail->AddAddress("*****[email protected]");
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
errors-:
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connectedThe following From address failed: *****[email protected]
This code is working well if I am using Gamil settings Not working with godaddy SMTP settings.
Upvotes: 1
Views: 3047
Reputation: 1495
Too late but helpful for other.
GoDaddy blocks all outgoing SMTP connections except for their own.
Call GoDaddy and ask them to add SMTP relay (eg gmail smtp.gmail.com) on server.
Upvotes: 1
Reputation: 2715
@vipulsharma,Its simple, you don't need to mentions host url directly to "relay-hosting.secureserver.net" because you are using the shared hosting so you have to point your host destination to your localhost folder only. For shared hosting, GoDaddy already configured the host setting internally. do change in the following changes in your code.
$mail->Host= 'localhost';
$mail->ssl=false;
$mail->authentication=false;
$mail->Port=25;
Upvotes: 0
Reputation: 1416
I checked your code, and expecting few reasons for the error.
if the above both are solved, please modify the code by adding the extra line as follows.
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->SMTPAuth = true;
This found working well in my server.
From THIS question, it describes the server blocking of SSL SMTP connection in shared hosting. So make the mailer to use TLS, to do so, change port no and SMTP mode.
$mail->SMTPSecure = "tls";
$mail->Port = 587;
And specifically you told that you are using godaddy hosting, as per This question, change your host configuration to
$mail->Host = localhost;
Upvotes: 1
Reputation: 1
First include include("PHPMailerAutoload.php");
and PHPmailerAutoload.php will load a class that you need, in your case class.smtp.php.
include("PHPMailerAutoload.php");
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug =1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "box###.bluehost.com"; // sets the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "admin@****.in";
$mail->Password = "******";
$mail->SetFrom('admin@****.in', 'Sender name');
$mail->Subject = 'mailing';
$mail->Body = "<b>Hi, your e- mail has been received.</b>";
$mail->AddAddress("*****[email protected]", "User name");
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
Upvotes: 0