Page 1 of 1

phpmailer Error (Could not instantiate mail function)?

Posted: Thu Aug 28, 2008 4:11 pm
by Mds
Hi there guys.
I used phpmailer class to send mail in php on IIS on windows server

this is my code :

Code: Select all

require("include/mailer/class.phpmailer.php");
$mail = new PHPMailer();
 
$mail->From = "me@communitymx.com";
$mail->FromName = "My Name";
$mail->AddAddress("mds_soft@yahoo.com");
$mail->Subject = "Test PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
 
$mail->Send();
 
echo $mail -> ErrorInfo;
But each time I just see this error : Could not instantiate mail function
How can I solve it ?
Thanks in advance.

Re: phpmailer Error (Could not instantiate mail function)?

Posted: Fri Aug 29, 2008 5:23 pm
by Mds
I've got the answer by contact phpmailer group.
On IIS we have to use sth like this script for sending mail.

Code: Select all

require("include/mailer/class.phpmailer.php");
$mail = new PHPMailer();
 
$mail->From = "me@communitymx.com";
$mail->FromName = "My Name";
 
$mail->AddAddress("mds_soft@yahoo.com");
$mail->Subject = "Test PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
 
$mail->Subject    = "PHPMailer Test Subject via smtp";
 
$mail->Host = "mail.sth.com"; // SMTP server
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true;
$mail->Username = "smtp Username ";  // your SMTP username
$mail->Password = "smtp password"; // your SMTP password
 
if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
Although these file are in /include/mailer/
class.smtp.php
class.phpmailer.php
class.pop3.php