/    Sign up×
Community /Pin to ProfileBookmark

e-mail info send by e-mail

i would like to send a sort of template with information as chosen by the user in a form of an e-mail. Do you have an idea how to formulate this template to be send by e-mail. The server fills in the e-mail and send it to a pre set e-mail address. Is there a sort of script?
Thanks in advance

to post a comment
PHP

22 Comments(s)

Copy linkTweet thisAlerts:
@spykemitchellSep 20.2003 — What kind of info do you want to send?

Name / Email Address / Comments ?
Copy linkTweet thisAlerts:
@tetuauthorSep 20.2003 — i would like to send info like name surname and other fieleds filled in with numbers but not all the fields must be filled out only the fields with name, surname and address must be filled
Copy linkTweet thisAlerts:
@spykemitchellSep 21.2003 — This script allows you to send a name an email address and a comments section...

[COLOR=deeppink]INSERT THIS INTO YOUR HTML DOCUMENT[/COLOR]

<table>

<tr>

<td><div id="scroll3" style="width:100;height:25;overflow:none"><font face="arial" color="#ffffff" size="2">Name:</td>

<td><form action="mailer.php" method="post">

<input type="text" size="22" name="name"><br></td>

</tr>

<tr>

<td><div id="scroll3" style="width:100;height:25;overflow:auto"><font face="arial" color="#ffffff" size="2">Email: <br></td>

<td><input type="text" size="22" name="email"><br></td>

</tr>

<tr>

<td><div id="scroll3" align="top" style="width:100;height:30;overflow:auto"><font face="arial" color="#ffffff" size="2">Question: <br></td>

<td><textarea cols="17" rows="5" name="message"></textarea><br></td>

</tr>

</table>

<table>

<td><div id="scroll3" align="center" style="width:200;height:50;overflow:auto;"><input type="submit" name="submit" value="Submit Form"><br>

</form>

</tr>

</table><br><br>



[COLOR=darkblue]PUT THIS AS A STANDALONE SCRIPT IN THE SAME DIRECTORY AS YOUR PAGE[/COLOR]

[code=php]<?PHP

$to = "[email protected]"; # This is who the form is sent to
$subject = "Subject"; # This is the ubject
$headers = "From: "; # This is the header in the email
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; # Where do you want your visitor to be redirected after sending the email?

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "The Following Help Message Was Sent On: $date At: $time.nn";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thankyou For Sending Your Email. We Will Reply Soon.";
}

?>
[/code]


If you need more help just ask!

Spyke.
Copy linkTweet thisAlerts:
@buddybearSep 21.2003 — I'm trying to accomplish the same thing but have a question.

The form I'm working on was made for mailto and I was advised to use PHP instead. When the form is sent I want to receive the form results by e-mail and I want the sender to be directed to a confirmation page.

Where do I add the script to my form and how do I add this as a stand alone script in the same directory as my page?

Thanks in advance.
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — A couple of things. First of all, spykemitchell, is there a reason you posted my mailer.php code minus the copyright headers? Generally, it's considered good practice when you take someone else's script, to give them the credit. :rolleyes:

Anyway, the original in all it's glory can be found at http://www.webdevfaqs.com/php.php#mailer, which will also help buddybear out, as it contains the readme/documentation.
Copy linkTweet thisAlerts:
@spykemitchellSep 21.2003 — He he :p

That wasn't done on purpose, i took out the comments becuse i was having difficulty making it run on abyss and then copied the script straight out of my .php document...

Sorry about that... tell you what...

ADD THIS AT THE TOP OF THE PHP SCRIPT

# Copyright Pyro NOT Spyke Mitchell.


# Spyke Mitchell is a script theiving,


# Copyight removing,


# evil snivelling toerag and doesn't deserve to lick the groud where pyro has walked...


# Remember Pyro Good, Spyke [COLOR=orangered]EVIL LITTLE SOD![/COLOR]



Do you feel better for that Pyro????

? ? :p
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — Nope, that's not necessary either. Just some mention that the script was originally created by me when you post it would be appreciated, and you might even find it easier to link to it on http://www.webdevfaqs.com/php.php#mailer than to post the code directly.
Copy linkTweet thisAlerts:
@spykemitchellSep 21.2003 — Where's your sense of humor mate?

It's not even on the web yet, just sitting on my computer and you made it perfectly clear that it was your script, Not that comments matter because as i was told you cant even view the source of a PHP script on the net anyway....

All you moderators should liven up a bit and have a nice cold german beer...
Copy linkTweet thisAlerts:
@buddybearSep 21.2003 — Thank you both for your reply.

So I need to place the HTML in my form script replacing all the mailto code.

I'm still not sure what you mean when you say to 'Put this as a stand-alone script in the same directory as your page'

My host supports PHP, do I have to do anything on their end?

Thanks
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — Did you download the mailer.zip file from the link above and read the readme? It should explain it all to you.
Copy linkTweet thisAlerts:
@buddybearSep 21.2003 — Pyro,

When I download your files and unzip them the mailer is in a format that tries to open in printshop so I can't open that file Can you please post that file only?

Thanks
Copy linkTweet thisAlerts:
@spykemitchellSep 21.2003 — Thats because certain programs use the same file type as .php scripts....

to edit it you need to right clik it and select open with > Notepad

and you will see the script....

Just place the script saved as .php on your server and the html with the mail to replaced with the form i posted in the same directory and you are good to go...
Copy linkTweet thisAlerts:
@buddybearSep 21.2003 — Thanks. I was able to open the file.

I should be able to get to trying the script later today. Do I need to contact my host to place the script on the server or do I just uplaod it with FTP?
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — Just upload it with FTP. Unlike Perl script, PHP can be run from any directory on the server.
Copy linkTweet thisAlerts:
@tetuauthorSep 21.2003 — when i'm trying the pho example it comming the php script and no e-mail is send what could be the problem ???

thank you
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — Does your server support PHP? You can check by naming this test.php and uploading it to your server:

[code=php]<?PHP
echo "I have PHP!";
?>[/code]
Copy linkTweet thisAlerts:
@tetuauthorSep 21.2003 — as a server i'm using tomcat and when i tried that you gave me and went on it the php file was opened in the web browser. what server should i use??
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — If you have control over your server, just [URL=http://www.php.net/downloads.php]download[/URL] PHP and install it...
Copy linkTweet thisAlerts:
@tetuauthorSep 21.2003 — how do you install it using windows?? in which directory you need to place it ??
Copy linkTweet thisAlerts:
@pyroSep 21.2003 — You can download the [URL=http://us4.php.net/get/php-4.3.3-installer.exe/from/a/mirror]Window's installer[/URL], and for my testing server, I just put it in the default directory of C:PHP
Copy linkTweet thisAlerts:
@buddybearSep 22.2003 — Thanks for your help. It works fine.
Copy linkTweet thisAlerts:
@pyroSep 22.2003 — No problem... ?
×

Success!

Help @tetu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...