getting following error:
SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No such host is known. (0) SMTP Error: Could not connect to SMTP host. There was a problem sending this mail!
This is my config file setting as I have followed this PHPMailer tutorial
// Configuration settings for My Site
// Email Settings
$site['from_name'] = 'Manish Dekavadiya'; // from email name
$site['from_email'] = 'manish@<my-domain>.com'; // from email address
// Just in case we need to relay to a different server,
// provide an option to use external mail server.
$site['smtp_mode'] = 'enabled'; // enabled or disabled
$site['smtp_host'] = "smtp.<my-domain>.com";
$site['smtp_port'] = 587;
$site['smtp_username'] = "manish@<my-domain>.com";
$site['smtp_password']="<password>";
and used mailer class and an extended class as mentioned in tutorial as following:
/*****sendmail.php****/
// Grab our config settings
require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
// Grab the FreakMailer class
//echo $_SERVER['DOCUMENT_ROOT'];
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/MailClass.inc');
// instantiate the class
$mailer = new FreakMailer();
// Set the subject
$mailer->Subject = 'This is a test';
$mailer->SMTPDebug = 1;
// Body
$mailer->Body = 'This is a test of my mail system!';
// Add an address to send to.
$mailer->AddAddress('[email protected]', 'Manish Dekavadiya');
if(!$mailer->Send())
{
echo 'There was a problem sending this mail!';
}
else
{
echo 'Mail sent!';
}
$mailer->ClearAddresses();
$mailer->ClearAttachments();
also getting another error when I tried an example given in phpmailer docs @ examples/test_smtp_gmail_basic.php
SMTP -> ERROR: Failed to connect toserver: php_network_getaddresses: getaddrinfo failed: No such host is known. (0) SMTP Error: Could not connect to SMTP host. There was a problem sending this mail!
so there must be setting or configuration error. there can't be code error.
smtp.your-domain.com
exists? Who gave you that information, the web host? – Ploughman