Page 1 of 1

mail form on a home server

Posted: Thu Jan 30, 2003 10:11 am
by twistbrain
i host a website on my pc and i want a mail form, but i cannot submit any forms.
this is the line where the error occurs:

mail($recipient, $subject, $msg, $mailheaders) or die ("Couldn't send mail!");

i think its something with smtp server, you can't send a mail out of nothing. is it possible to add a line or a script which will set a smtp?
im a noob at php so... :oops: :lol: !

Posted: Thu Jan 30, 2003 10:18 am
by twistbrain
here is the script where i wanna add something that will make it work on my server:

<?

// Copyright by filedesign.com 2001, 2002
// Information: Do not change the name of this file, it' ill not work !


// Configuration of recipient and subject.
$recipient = "yourmail@yourdomain.com";
$subject = "Contact Form";


// Please do not change anything below this line!!!
// ________________________________________________

$mailheaders = "From: <$sender_email> \n";
$mailheaders .= "Reply-To: <$sender_email>\n\n";

$msg = "_____________________________________________________________________\n";
$msg .= "Sender's Name: $sender_name\n";
$msg .= "\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "\n";
$msg .= "Company: $sender_company\n";
$msg .= "\n";
$msg .= "Website: $sender_website\n";
$msg .= "\n";
$msg .= "Message:\n\n$sender_message\n";
$msg .= "\n";
$msg .= "_____________________________________________________________________";

mail($recipient, $subject, $msg, $mailheaders) or die ("Couldn't send mail!");

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Form sent...</TITLE>

</HEAD>

<body bgcolor="white" text="black">
<div align=center>

<?
echo "<table border=0 width=400>\n";
echo "<tr><td colspan=2>You sent the following data:</td></tr>\n";
echo "<tr><td valign=top><b>Name:</b></td><td>$sender_name</td></tr>\n";
echo "<tr><td valign=top><b>E-Mail:</b></td><td>$sender_email</td></tr>\n";
echo "<tr><td valign=top><b>Company:</b></td><td>$sender_company</td></tr>\n";
echo "<tr><td valign=top><b>Website:</b></td><td>$sender_website</td></tr>\n";
echo "<tr><td valign=top><b>Message:</b></td><td>$sender_message</td></tr>\n";
echo "</table>\n";

?>

</div>

</body>
</html>

Posted: Fri Jan 31, 2003 3:19 am
by twigletmac
Which OS are you using (and which version).

Mac

Posted: Sat Feb 01, 2003 4:36 am
by twistbrain
i am using windows 98SE, and my server runs on Apache, i dont know which version it is, i think not the new but the one before the newest version.

Posted: Sat Feb 01, 2003 4:58 am
by twistbrain
wait, i fixed the problem!

i changed lines in PHP.ini
on the lines:

[mail function]
SMTP=yoursmtpserver
Sendmail_from=yourmail@localhost.com
//and if you have a password protected SMTP mail, then add these lines:
username=yourusername
password=your password

i just made a guess and it worked :lol:
good for a newbie aight?!? :twisted: