Jump to content

phpmailer help please...


jintot

Recommended Posts

Good day experts! I got this php code

 

include 'phpmailer/class.phpmailer.php';
include 'phpmailer/class.smtp.php';

$mail= new PHPMailer;

$mail->IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Host = "smtp.mail.yahoo.com";
$mail->Port = "25";
$mail->Username = "xxx@yahoo.com"; // SMTP username
$mail->Password = "xxxxx"; // SMTP password
$webmaster_email = "xxx@yahoo.com"; //Reply to this email ID
$email="xxx@gmail.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
  echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
  echo "Message has been sent";
}

 

when i executed it, the error says : Mailer Error: Language string failed to load: connect_host

 

all xxx are just dummy for this post... and i'm going to use yahoo as my smtp server.

what do you think is problem? thanks!

Link to comment
Share on other sites

This part of the error message - "Language string failed to load" means that you did not copy the "language" folder that is part of the phpmailer script to your server.

 

Once you put the language folder on the server, the error message will output as -

 

SMTP Error: Could not connect to SMTP host.

 

This means that the host name/port is incorrect. The correct settings should be -

 

Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com (Use SSL, port: 465, use authentication)

 

If this does not work, that would mean that the port is probably blocked, either by some firewall software on your server, by your hosting company, by your router, or by your ISP. You would need to provide more information about where your php script is running and how it is connected to the Internet to get more specific help.

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.