mail function

Support, Snippets & Projects

Moderators: Moderator, Global Moderator

Post Reply
Vercz
Hero Member
Hero Member
Posts: 1915
Joined: Sun May 09, 2004 6:13 am

mail function

Post 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 <img src=\'http://www.killanet.net/forum3/public/s ... #>/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 <img src=\'http://www.killanet.net/forum3/public/s ... sleepy.gif\' class=\'bbc_emoticon\' alt=\'(sleep)\' /> [/color]
Image

Image
Josh
Hero Member
Hero Member
Posts: 4627
Joined: Fri Jun 04, 2004 2:54 pm

mail function

Post by Josh »

What is [b]$subject $comments [/b]and[b] $email[/b] set to?
[align=center]

Image

“If you stop learning, you stop living.” ~Tami Quiring

“It's the rare man who understands the value of a single perfect rose.”

[/align]
ner0
Hero Member
Hero Member
Posts: 982
Joined: Sat May 22, 2004 4:45 pm

mail function

Post 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 <img src=\'http://www.killanet.net/forum3/public/s ... igwink.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 <img src=\'http://www.killanet.net/forum3/public/s ... >/good.gif\' class=\'bbc_emoticon\' alt=\'(Y)\' />
Last edited by ner0 on Wed Dec 29, 2004 7:32 pm, edited 1 time in total.
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <- :( poor class



[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Vercz
Hero Member
Hero Member
Posts: 1915
Joined: Sun May 09, 2004 6:13 am

mail function

Post 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]
Image

Image
ner0
Hero Member
Hero Member
Posts: 982
Joined: Sat May 22, 2004 4:45 pm

mail function

Post by ner0 »

<img src=\'http://www.killanet.net/forum3/public/s ... >/good.gif\' class=\'bbc_emoticon\' alt=\'(Y)\' /> glad it worked out vercy
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <- :( poor class



[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Post Reply

Return to “PHP &amp; MySQL”