Page 1 of 1

mail function

Posted: Tue Dec 28, 2004 6:31 pm
by Vercz
well..ive got a contact style mail thingy (technical, i know) on my website..and when i get an email sent to me from my site..it comes up as being sent by "anonymous@ev1..blah" ..that doesnt bother me..what does is that i get no text or anything in the email..there is no body to it /cry.gif' class='bbc_emoticon' alt=':(' />

HTML (contact.php)

Code: Select all

<form method='post' action='comments.php'>E-Mail: <INPUT TYPE='TEXT' NAME='email' size=30><br>Subject: <INPUT TYPE='TEXT' NAME='subject' size=30><br>Comments: <TEXTAREA NAME='comments' ROWS=10 COLS=30></TEXTAREA><br><input type='submit' name='submit' value='submit'></form>

PHP (comments.php)

Code: Select all

<?
    mail("vercz@killanet.net", "$subject", "$comments", "$email");
	header ("Location: http://vercz.killagraphix.com");
?>
im stumped /sleepy.gif' class='bbc_emoticon' alt='(sleep)' /> [/color]

mail function

Posted: Wed Dec 29, 2004 9:37 am
by Josh
What is $subject $comments and $email set to?

mail function

Posted: Wed Dec 29, 2004 11:29 am
by ner0
firstly, just incase you didn't set $email etc, they can be set by doing something like this for each variable...

[quote]$email = $_POST["email"];[/quote]
(i assume this is already done though /bigwink.gif' class='bbc_emoticon' alt=';)' /> )

if the body is formed by $comments, after doing the above I'd use a syntax something like:

[quote]mail("vercz@killanet.net",$subject,$comments);[/quote]
that'd be the solution in its most simple form, however, if you dislike the anon@ev1server...

you can use something like this:

[quote]mail("vercz@killanet.net", $subject, $comments,
    "From: feedback@vercz.killanet.net\r\n" .
    "Reply-To: {$email}\r\n")[/quote]

that should show up in your inbox as being from feedback@vercz.kn, doesn't matter if the email address doesn't actually exist in this case... hope it helps /good.gif' class='bbc_emoticon' alt='(Y)' />

mail function

Posted: Wed Dec 29, 2004 7:54 pm
by Vercz
yay! it works now..i edited your code a bit ner0. now its like this

Code: Select all

<?
$email = $_POST["email"];
$subject = $_POST["subject"];
$comments = $_POST["comments"];

mail("vercz@killanet.net", "$subject", "$comments",
    "From: feedback@vercz.killanet.net\r\n" .
    "Reply-To: {$email}\r\n");
	header ("Location: http://vercz.killagraphix.com");
?>
whee ;x [/color]

mail function

Posted: Thu Dec 30, 2004 4:25 am
by ner0
/good.gif' class='bbc_emoticon' alt='(Y)' /> glad it worked out vercy