Jump to content

unable to send mails when using SMTP method


Recommended Posts

hi

my hosting company requires SMTP authentication to send emails. When i setup SMTP options nothing is happening, no error nor email working, but in few pages for example in send to a friend module when i send mail its redirecting to home page without giving successfully mail sent message.

when i contacted with my hosting company regarding this they provided me with a script to send mail, it is working perfectly, code is below

as i am new to PHP and prestashop i am unable to find whats the problem, please help me in this regard, thanks

code:

<?php
require_once "Mail.php";

$from = "Sachin Gupta ";
$to = "Znet ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.sendgiftstowarangal.com";
$username = "[email protected]";
$password = "**********";

$headers = array ('From' => $from,
 'To' => $to,
 'Subject' => $subject);
$smtp = Mail::factory('smtp',
 array ('host' => $host,
   'auth' => true,
   'username' => $username,
   'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
 echo("
" . $mail->getMessage() . "");
} else {
 echo("
Message successfully sent!");
}
?>

Link to comment
Share on other sites

KGal thanks for ur help,

when i use phpmailer its sending message but its delivery was failed and when i contacted my hosting company they said mail needs to be authenticated to send, is there any way to authenticate sending mail when using phpmailer.

and as i said in my first post the code which is provided by hosting company, which uses SMTP method working fine

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...