should this work? :PHP Code:mail ($form_to, $form_subject, $form_content);
Printable View
should this work? :PHP Code:mail ($form_to, $form_subject, $form_content);
Why quotes? Wouldn't that just cause more overhead because the runtime environment would have to parse the strings?
BTW UB, why aren't you posting in the forum that you moderate? :p
do i have to set up a POP3 or SMTP server for this to work ? or should it work standalone ?
- because i wated a little bit of a faster response time on this one :)Quote:
BTW UB, why aren't you posting in the forum that you moderate? :p
double quotes and no, so you can get the exact value of the string.Quote:
Originally posted by filburt1
Why quotes? Wouldn't that just cause more overhead because the runtime environment would have to parse the strings?
BTW UB, why aren't you posting in the forum that you moderate? :p
but if they are variables you don't need the quotes. only if they are in the regualar form.
mail("[email protected]", "the subject", $message,
"From: webmaster@$SERVER_NAME", "-fwebmaster@$SERVER_NAME");
ERROR:any idea what the problem could be ?Quote:
Warning: Failed to Connect in c:\windows\desktop\files\wwwroot\email.php on line 25
Here's the code if you want it:PHP Code:<html>
<head>
<title>My Little Email Page</title>
<style>
BODY, table
{font-family: verdana;
font-size: 11px;}
Input.submit,
Textarea.submit
{width: 200px;
font-family: tahoma;
font-size: 11px}
Textarea
{height: 100px}
</style>
</head>
<body>
<?PHP
IF (isset($action))
{
IF ($action == "sendmail")
{
//mail ( string to, string subject, string message)
mail ('$form_to', '$form_subject', '$form_content');
ECHO "would have been sent :)";
ECHO "<hr>";
}
}
?>
<b>Send an Email, <i>To</i> Anyone, <i>From</i> No one :)<b><br><br>
<form action="email.php?action=sendmail" method="post">
<input type="text" name="form_to"> - TO<br>
<input type="text" name="form_subject"> - Subject<br>
<textarea name="form_content"></textarea> - Message<br><br>
<input type="submit" value="Email">
</form>
</body>
</html>
are you running it off your server or a sites server? if your sever then you do have to setup smpt in the php.ini ifle and setup mail in httpd.conf file.
besides you will get parse errors on the img line, you forgot the to escape the "
<?PHP
IF (isset($action))
{
IF ($action == "sendmail")
{
//mail ( string to, string subject, string message)
mail ('$form_to', '$form_subject', '$form_content');
ECHO "would have been sent <img src=\"images/smilies/smile.gif\" border=\"0\" alt=\"\">";
ECHO "<hr>";
}
}
?>
thanx scoutt, I'll give that a try.
BTW. i dont know where on earth that image code came from, its not in the source of the original file, and i havnt dealt with any images with that name for ages (months), Is strange :D
anyway, thanx :)
I'm surprised you didn't bring up issues of deprecation, scoutt. ;)
before you can use the mail function in PHP, u need to have a mail service running on the PC - on linux systems, it's there by default i think, but not on WinNT etc.
I may be re-stating things, but to make it clear - Single quotes pass as they are, Double quotes get parsed by PHP. So Single quotes don't overload, double qs do. U need to make a wise choice whether to use double qs or concatenate strings and the variables.
good point, why didn't I :)
PHP Code:<?PHP
IF (isset($_REQUEST['action'] == "sendmail"))
{
//mail ( string to, string subject, string message)
mail ('$form_to', '$form_subject', '$form_content');
ECHO "would have been sent <img src=\"images/smilies/smile.gif\" border=\"0\" alt=\"\">";
ECHO "<hr>";
}
}
?>
i suppose that was for hobo?
Scoutt, don't you mean:
??PHP Code:<?PHP
IF (isset($_REQUEST['action'] == "sendmail"))
{
//mail ( string to, string subject, string message)
mail ($_REQUEST['form_to'], $_REQUEST['form_subject'], $_REQUEST['form_content']);
ECHO "would have been sent <img src=\"images/smilies/smile.gif\" border=\"0\" alt=\"\">";
ECHO "<hr>";
}
?>
yup :)