/    Sign up×
Community /Pin to ProfileBookmark

PHP Form mail

Does anyone here know where to get a good PHP Formmail script. I’ve heard so many horror stories using CGI Formmail. I don’t know a lick of PHP, so any help would be appreciated.

Thanks
Dave

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@dreamcatcherJan 14.2005 — Theres a simple PHP contact form on my site if you want to try it. If you dont like it, no biggie.

[URL=http://www.m-dream.co.uk]http://www.m-dream.co.uk[/URL]

You`ll need to register to download the free scripts. Click 'Maian Mail' from the 'PHP Scripts' menu.

Failing that try Hotscripts.com, they have loads more you can try.

dc

[b]ps, actually you dont need to register for the scripts[/b]
Copy linkTweet thisAlerts:
@djob66authorJan 14.2005 — thanks, I'll take a look.
Copy linkTweet thisAlerts:
@NogDogJan 14.2005 — Here's a simple, no-bells-and-whistles script which seems to work OK.
[code=php]
<?php
### simple form handler to send email ###

# set email address in following variables
# address will be concatenated as "$name@$location"
$name = "yourname";
$location = "yahoo.com";

$msg = ""; # body of email message

# parse the _POST or _GET array, depending which form method was used:
if(count($_POST) >= 1)
{
foreach($_POST as $key=>$value)
{
$msg .= "$key: $valuen";
}
}
elseif(count($_GET) >= 1)
{
foreach($_GET as $key=>$value)
{
$msg .= "$key: $valuen";
}
}
if($msg == "")
{
$result = "ERROR: No form data received.";
}
else # send the email
{
$address = "$name@$location";
$subject = "Web form submission";
$rc = mail($address, $subject, $msg,
"From: $addressrnReply-To: $address");
$result = $rc ? "SUCCESS: Form has been emailed." :
"ERROR: Email of form data failed.";
}

# display the results:
echo <<<EOD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'><head><title>Form Mail Handler</title>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<style type="text/css">
body {
background: white;
margin: 0;
padding: 2em;
font: medium/1.3em normal arial, sans-serif;
}
</style>
</head>
<body>
<h1>Form Email Results</h1>
<p>$result</p>
</body>
</html>
EOD;

?>
[/code]
×

Success!

Help @djob66 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...