Jump to content

Mailer Error: The following From address failed: username@gmail.com : Called Mail() without being connected


Recommended Posts

i am in great need to solve this.i received the error as Mailer Error: The following From address failed: shweta.pandit2013@gmail.com : Called Mail() without being connected when try to execute my mailform.php script.any help is greatly appreciated. i change the requires settings in php.ini as

smtp_port = smtp.gmail.com
sendmail_from = PHP_INI_ALL


the script is:


$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->SMTPAuth   = true; // SMTP authentication
$mail->Host       = "smtp.gmail.com";
$mail->SMTPSecure = "tls";
$mail->Port       = 587; // SMTP Port
$mail->SMTPDebug   = 2; // 2 to enable SMTP debug information
$mail->Username   = "abc@gmail.com"; // SMTP account username
$mail->Password   = "*******";        // SMTP account password

$mail->SetFrom($email, $name); // FROM

$mail->AddAddress('xyz@gmail.com'); // recipient email

$mail->Subject    = "Website- Contact Form"; // email subject
$mail->Body       = $msg;


if($mail->IsError()) //if(!$mail->Send())
{        echo 'Message was not sent.';
        echo 'Mailer errors: ' . $mail->ErrorInfo;
{        echo "Thank you ";



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • 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.