I'm hoping that someone will give me a moment so I can understand how formmail works so that I can more effectively troubleshoot my problems.
Background:
I'm downloaded a very basic formmail to use on our intranet site for employees to respond to. I'm testing this on a XP Pro machine and plan to move it to the Windows 2003 server once testing is done. Our email (Exchange) is hosted remotely by ASP-one. Using IIS version 5.2
Now, excuse my ignorance but I've had no exposure to formmail before and trying to put the pieces together.
I've installed PHP 5.2.6 and running a php script from Tectite.com (see attached). I run http://testserver/fm.php?testalert=1 and it returns "Test message sent. Check your email".
Here is where is need an understanding. Because i don't see anywhere that you configure your SMTP server then i'm assuming you need to setup IIS SMTP Virtual Server. So I did this using a SMART HOST setup to ASP-ONE SMTP and then tried another ISP which we use currently for other SMTP mail. Mail goes through the queue and then into BADMAIL.
I don't know what I am missing.
It is possible that no from address is set. That may be the cause of the server rejecting your message. You can check the message details for any headers.
I think this may be what is confusing me... Our email server uses authenticated SMTP which within the Virtual SMTP server I configure my mailbox userID and PW. My email address in the fm.php is different then the credentials which are required for the SMTP server.
What settings should I be using within the fm.php? Should they match my SMTP server which is configured to match our local domain name or should it match my remote email credentials?
If I may, I recommend using PHPMailer which you can find here http://phpmailer.codeworxtech.com/ . This is an amazing class which I have worked with many times and you will find documentation on their website as well as examples in this downloaded zip file.
Here you will see that you actually define the smtp server in your script.
<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
//date_default_timezone_set(date_default_timezone_get());
include_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = $mail->getFile('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.worxteam.com"; // SMTP server
$mail->From = "name@yourdomain.com";
$mail->FromName = "First Last";
$mail->Subject = "PHPMailer Test Subject via smtp";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress("whoto@otherdomain.com", "John Doe");
$mail->AddAttachment("images/phpmailer.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>