mail function

Support, Snippets & Projects

Moderators: Moderator, Global Moderator

Post Reply
Vercz
Hero Member
Hero Member
Posts: 1915
Joined: Sat May 08, 2004 11:13 pm

mail function

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

Image
Josh
Hero Member
Hero Member
Posts: 4627
Joined: Fri Jun 04, 2004 7:54 am

mail function

Post by Josh »

What is $subject $comments and $email 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 9:45 am

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 /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)' />
Last edited by ner0 on Wed Dec 29, 2004 11:32 am, 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: Sat May 08, 2004 11:13 pm

mail function

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

Image
ner0
Hero Member
Hero Member
Posts: 982
Joined: Sat May 22, 2004 9:45 am

mail function

Post by ner0 »

/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”