Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 07-15-2004, 05:45 AM
I, Brian's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-26-03
Posts: 1,911
iTrader: 0 / 0%
need simple e-mail script

I need to get my head around basic e-mail scripts:

ie,

You have a form, that asks for name, e-mail address, and then has text area.

User fills it in, clicks on "send" - new page loads up thanking user for sending e-mail.

Does anyone have any script examples I can play with? Much appreciated.
 
Reply With Quote
  #2 (permalink)  
Old 07-15-2004, 06:31 AM
fishfreek's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-13-03
Location: Virginia
Posts: 844
iTrader: 0 / 0%
Here is a very very simple e-mail form that I use. The first code goes in any html page. Name the second file as emailprocess.php or if you change the file name change the reference in the first code.

You can add more php or html programming on the php form to redirect after submitting the e-mail if you wish. I just included the functional parts.


[code:1:88c187259a] <form name="form1" method="post" action="emailprocess.php">
<p><strong>Name:</strong><br>
<input name="ContactName" type="text" size="40" maxlength="80">
</p>
<p><strong>Your email:</strong><br>
<input name="email" type="text" size="40" maxlength="80">
</p>
<p class="bodb">Enter your comments and
inquiries here:<br>
<textarea name="comments" cols="30" rows="5"></textarea>
</p>
<p align="right">
<input name="imageField" type="submit" src="images/go.gif" width="62" height="45" border="0">
</p>
</form>[/code:1:88c187259a]

[code:1:88c187259a]<?php

//Mail function
$toaddress = "E-mail addres you want the e-mail sent to.";

$subject = "Subject you want on the e-mail";

$mailcontent = "Contact Name: ".$ContactName." \n"
."E-Mail Address: ".$email." \n"
."Comments: ".$comments." \n";

$fromaddress = "E-mail address to show in the from field.";

mail($toaddress, $subject, $mailcontent, $fromaddress);

?> [/code:1:88c187259a]
 
Reply With Quote
  #3 (permalink)  
Old 07-15-2004, 06:55 AM
Contributing Member
Latest Blog:
None

 
Join Date: 07-09-04
Posts: 150
iTrader: 0 / 0%
I wrote this, give it a try. You can see how it looks on my site, or hit the demo link.

http://www.greatnexus.com/downloads/contact-us.php
__________________
Greatnexus - add your site today and stay on top of your niche.
 
Reply With Quote
  #4 (permalink)  
Old 07-15-2004, 08:44 AM
Pipeline-Webdesign's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 433
iTrader: 0 / 0%
if you want to go real spiffy do this: :-D you can thank me later!

Quote:
Originally Posted by form.php
[code:1:72d5616a54]<head>
<script src="site.js" type="text/javascript"></script>
</head>[/code:1:72d5616a54][code:1:72d5616a54]<body>
<form name="mainform" method="POST" action="form-submit.php" onSubmit="return form_Validator(this)">

Name: <input type="text" size="20" name="name"><br>Email Address: <input type="text" size="20" name="email"><br>Message: <textarea cols="20" rows="4" name="message"><br><input type="submit" name="submit" value="Submit Email">
</form>
</body>[/code:1:72d5616a54]
Quote:
Originally Posted by form-submit.php
[code:1:72d5616a54]<?php

$name = stripslashes($_POST['name']);
$mailto = "user@domain.com";
$emailfrom = stripslashes($_POST['email']);
$body = stripslashes($_POST['message']);

$message = "Sender: <$name> $emailfrom\n";
$message .= "Message: $body\n\n";

mail($mailto, $message, "From: $name <$emailfrom>");

echo 'Thank you for submitting your email.';
?>[/code:1:72d5616a54]
Quote:
Originally Posted by site.js
[code:1:72d5616a54]function form_Validator(form)
{
if (form.name.value == "")
{
alert("Please enter your full name.");
form.name.focus();
return (false);
}

if (form.email.value == "")
{
alert("Please enter your email address. (i.e. username@domain.com)");
form.email.focus();
return (false);
}

if (form.message.value == "")
{
alert("Please enter a message to be sent.");
form.subject.focus();
return (false);
}

return (true);
}[/code:1:72d5616a54]
Then you're in business. You have a simple form that emails to "user@domain.com" and at the same time a simple script that validates that the fields aren't empty. If one is empty, it alerts the user, and brings the cursor directly to the field they missed. Let me know what you think! :-D
__________________
MichaelF[at]pipeline-webdesign.com
 
Reply With Quote
  #5 (permalink)  
Old 07-15-2004, 01:22 PM
Pipeline-Webdesign's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 433
iTrader: 0 / 0%
did it work?
__________________
MichaelF[at]pipeline-webdesign.com
 
Reply With Quote
  #6 (permalink)  
Old 07-16-2004, 04:03 AM
Junior Member
 
Join Date: 07-16-04
Posts: 4
iTrader: 0 / 0%
I have used NATES email script on my site, I find that it is both easy to use and very elegant. He also has a support.


http://www.mindpalette.com/formprocessing/index.php
 
Reply With Quote
  #7 (permalink)  
Old 07-19-2004, 07:59 AM
I, Brian's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-26-03
Posts: 1,911
iTrader: 0 / 0%
Thanks for the replies folks - trying them out now.

Apologies for not replying earlier - working to some rather major deadlines.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail Script & Spam gobeyond Coding Forum 8 08-23-2006 11:06 AM
Help with simple script piolilly Coding Forum 1 05-15-2005 03:13 PM
E-mail script ParLawGod Web Design Lobby 1 09-16-2004 02:24 PM
Very simple script? I, Brian Coding Forum 12 12-28-2003 02:00 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 09:19 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.