PDA

View Full Version : PHP (Win) mail Server config


Terry
05-02-2003, 10:17 PM
I'm trying to get my IIS server to sendmail like it does on Apache. I'm working from my home and I installed php on IIS.. I wish I would of used Apache but I kinda like being able to use ASP and PHP without switching servers.

I'm not sure how to configure the ini file. This is what I have:



[mail function]
; For Win32 only.
SMTP = nbsj.phub.net.cable.rogers.com
// I was told by my cable provider that this is the right address
// to there server

; For Win32 only.
sendmail_from = xDev@rogers.com
// this is my email address at rogers

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =



Any help would be appreciated. I am getting tired of uploading my php mail scripts to my host(apache) just so I can test the damn things. I have a pretty good development platform going on at home and the only thing that is missing is the ability to send mail.

This is the script I'm trying to send:



<?php
/*
sending out the email

mail(to,subject,body,headers);

*/

$uname = $HTTP_POST_VARS['userName'];
$uemail = $HTTP_POST_VARS['userEmail'];
$uphone = $HTTP_POST_VARS['userPhone'];
$ufax = $HTTP_POST_VARS['userFax'];
$comments = str_replace("\r", "<br />", $HTTP_POST_VARS['comments']);

$mail_to = "terry@conspiracyarchive.com";
$mail_subject = "GTA Form Submission";
$mail_body = $uname;
$mail_body .= " sent you the following message from the GTA website: ";

$mail_body .= "<p>$comments</p>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $uname <$uemail>";


if(mail($mail_to,$mail_subject,$mail_body,$headers)) {
$str = "<div class='subResult'>Thank you for your inquiry.";
$str .= " An email has been sent with your request, we will get in touch with you ASAP.</div>";
echo $str;
} else {
$str = "There was a problem sending the mail.";
$str .= " Please check that you <a href='javascript: void(history.back());'>filled";
$str .= " in the form correctly</a>.";
echo $str;
}
?>



It doesn't even echo anything when I send the form. The else doesn't even show?

Terry

firepages
05-04-2003, 03:28 PM
unless your mai;server requires authentication then that should work fine , PHP mail() does not worry about the platform or server.

possibly you have a mail server running (courtesy of IIS ?) and that server can not understand what PHP is giving it ??

anyway , try a real simple script and let us know what happens...


<?
if(!mail('you@yours','test','testing')){
echo 'error sending mail';
}else{
echo 'please check your inbox';
}
?>

Terry
05-04-2003, 04:05 PM
The script printed "error sending mail". Now that you mention it, my mail server does require authentication. Is there anyway I can get around this?


Thanks,
Terry