Reputation: 14328
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
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):
I'd recommend, as others have, using SwiftMailer or PHPMailer instead.
Upvotes: 4
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
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