angeljyt wrote:see php manual for function mail(),
Notes
????: The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA ( Mail Transport Agent ) is needed listening on a network socket (which can either on the localhost or a remote machine).
Hi,
Thanks for the reply. The mail() function does work, and I can get it to submit an email, but I have to use the following code in the form:
<FORM method=post action="sendmail.php">
then in the sendmail.php
mail( "me@mydomain.com", $subject, $message, "From: $name <$email>" );
However, this only sends data from the form, I'd like to also include some other variables along with the message, which are set outside of the form, such as:
$time = date("H:i");
$date = date("dS M Y");
$ip = getHostByAddr($REMOTE_ADDR);
$HTTP_USER_AGENT = $HTTP_USER_AGENT;
I used to be able to send these on the old linux system by using:
include('../include/sendmail.php');
$time = date("H:i");
$date = date("dS M Y");
$ip = getHostByAddr($REMOTE_ADDR);
$HTTP_USER_AGENT = $HTTP_USER_AGENT;
<form action="'. $PHP_SELF .'" method=post>
<input name="email" size="35" type="TEXT">
<input name="subject" size="35" type="TEXT">
<textarea cols="35" name="msg" rows="10"></textarea>
<input name="submitform" type="submit" value="Submit Form">
Then when you press submit, it's parsed using the function below:
if ($submitform){
mailfunction($name,$email,$subject,$time,$date,$ip,$HTTP_USER_AGENT,$msg);
}
Then sendmail.php consisted of the following function:
function mailfunction($name,$email,$subject,$time,$date,$ip,$HTTP_USER_AGENT,$msg){
$message = "You have received the following message\n".
"----------------------------------------\n".
"$msg\n\n".
"From\n".
"$name $email\n".
"----------------------------------------\n".
"Submitted at $time on $date\n".
"By IP Address $ip\n".
"Using $HTTP_USER_AGENT";
mail ($recipient,$subject,$message,"From: $name <$email>");
}
Any variable defined in the action "if ($submitform)" would get passed to the mailfunction() that existed in sendmail.php. But that doesn't seem to happen now!
Ben