phpmailer Error (Could not instantiate mail function)?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

phpmailer Error (Could not instantiate mail function)?

Post 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.
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

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

Post 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
Post Reply