Page 1 of 1

mail function

Posted: Wed Dec 29, 2004 2:31 am
by Vercz
[color=\"green\"]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]<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>[/code]


PHP (comments.php)
[code]<?
   mail("vercz@killanet.net", "$subject", "$comments", "$email");
header ("Location: http://vercz.killagraphix.com");
?>[/code]

im stumped /sleepy.gif\' class=\'bbc_emoticon\' alt=\'(sleep)\' /> [/color]

mail function

Posted: Wed Dec 29, 2004 5:37 pm
by Josh
What is [b]$subject $comments [/b]and[b] $email[/b] set to?

mail function

Posted: Wed Dec 29, 2004 7:29 pm
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: Thu Dec 30, 2004 3:54 am
by Vercz
[color=\"green\"]yay! it works now..i edited your code a bit ner0. now its like this

[code]<?
$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");
?>[/code]

whee ;x [/color]

mail function

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