S L
S L

Reputation: 14328

php mail() not working in IIS 6

HI my code

$send_contact=mail($to, $subject, $message, $header);

if($send_contact){

    echo "mail was sent successfully";

}

else{

    echo "mail could not be send";

}

in not working in IIS6 for windows server. It sends success message but email is not sent http://interfacenepal.com/contact/contact.php phpinfo details can be found at http://interfacenepal.com/contact/testing.php

Upvotes: 2

Views: 1584

Answers (4)

Kev
Kev

Reputation: 119846

You don't mention what version of PHP you're using, however the mail() function in PHP for Windows is a bit buggy (certainly in 5.2.6 to 5.3.0):

Bug #28038 Sent incorrect RCPT TO commands to SMTP server

I'd recommend, as others have, using SwiftMailer or PHPMailer instead.

Upvotes: 4

Conex
Conex

Reputation: 822

Except using Swift Mailer or PHPMailer you need to make sure your server is configured properly to use another server to send emails.

Upvotes: 0

Álvaro González
Álvaro González

Reputation: 146563

The warnings in your test page suggest that you are be using Gmail's SMTP server. Gmail requires both encryption and authentication and these features are not supported by plain mail() function. You need to use a library that implements them, such as Swift Mailer or PHPMailer.

Upvotes: 3

SW4
SW4

Reputation: 71220

Have you thought about using PHPMailer- it has more sophisticated means available to send mail should the mail() function fail, and better error support in general...not to mention a whole raft of functionality.

Upvotes: 0

Related Questions