I want to send authenticated mail in php. i know smtp and phpmail classes. Is there anyone to help me? I have followed scripts on net but, i couldn't send an email. Anyone with working solution?


Recommended Answers

All 4 Replies

Why don't you post your code, then we may be able to assist...

The error i receive is "Fatal error: Call to undefined function IsSMTP() in C:\wamp\www\Email\send.php on line 6

$mail=new PHPMailer();

IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username"; // SMTP username
$mail->Password = "password"; // SMTP password
$webmaster_email = "something@xxx.com"; //Reply to this email ID
$email="something@xxx.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$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
  echo "Mailer Error: " . $mail->ErrorInfo;
  echo "Message has been sent";

Also, What do i have to change in class.phpmailer.php file?


OR. This one generates "Message Not Sent
Mailer Error: SMTP Error: Could not connect to SMTP host. ". I am very sure about my smtp server.

  $To = $_POST['To'];
  $From = $_POST['From'];
  $FromName = $_POST['FromName'];
  $Subject = $_POST['Subject'];
  $Message = $_POST['Message'];
  $Host = $_POST['Host'];
  if (array_key_exists('HTML',$_POST))
   $HTML = true;
   $HTML = false;
  $Mail = new PHPMailer();
  $Mail->IsSMTP(); // send via SMTP
  $Mail->Host = $Host; //SMTP server
  if (array_key_exists('Username',$_POST))
  $Mail->From = $From;
  $Mail->FromName = $FromName;
  $Mail->WordWrap = 50; // set word wrap
  $Mail->Subject  = $Subject;
  $Mail->Body = $Message;
   echo "Message Sent";
    echo "Message Not Sent<br/>";
    echo "Mailer Error: " . $Mail->ErrorInfo;

solved with different smtp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.