Hi,

I'm having probems getting the mail() function to work locally on IIS - have tried using both a basic mail() call and also phpmailer as below:

require_once('../class.phpmailer.php');

$mail = new PHPMailer();

$mail->SetFrom('myname@btinternet.com', 'Name');

$mail->AddReplyTo("myname@btinternet.com","Name");

$address = "myname@hotmail.com";
$mail->AddAddress($address, "My name");

$mail->Subject = "PHPMailer Test Subject via mail(), basic";

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->Body = "Here is the message";

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!!!";
}

The following error message is output to browser:

"Could not instantiate mail function. Mailer Error: Could not instantiate mail function."

php.ini has the following settings:

[mail function]
; For Win32 only.
SMTP = mail.btinternet.com
smtp_port = 25

; For Win32 only.
sendmail_from = myname@btinternet.com

SMTP server is running and can send and receive emails OK in Outlook with same btinternet settings - also no problem using mail() function on hosting server on Linux.

Thanks in advance for any help

    is the "Default SMTP Virtual Server" installed and running within IIS?

    If this isn't installed you can do so via add/remove programs -> windows components

      Yes, "Default SMTP Virtual Server" is running on IIS

        try removing "mail()" from this line:

        $mail->Subject = "PHPMailer Test Subject via mail(), basic";
        

        also, do you get a line number in the error output?

          Still same problem removing 'mail()' from subject line - it's the standard subject text in all the phpmailer examples anyway - and no line number given when error displayed.

          To add to confusion I have no localhost mail() problems on another PC at a different location - also on IIS but using PHP4 and a different ISP (talktalk) with their relevant smtp mail server settings.

            Write a Reply...