Do You Want A Mail Form In Your Site

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Do You Want A Mail Form In Your Site

ejasoft
Notice from m^e:
Repeat post. Credits reduced by 5 days. Learn to USE THE SEARCH BUTTON before you make such posts.


did you want to have in your web site mail form
that allow the user
to send mails to anther mail from his mail e.g. the compose in yahoo
CODE


<body>
<form name="email" method="post">
<table align="center">
<tr>
<td>from</td>
<td align="right"><input type="text" size="60" name="from" /></td>
</tr>

<tr>
<td>to</td>
<td align="right"><input type="text" size="60" name="to" /></td>
</tr>

<tr>
<td>cc</td>
<td align="right"><input type="text" size="60" name="cc" /></td>
</tr>

<tr>
<td>bcc</td>
<td align="right"><input type="text" size="60" name="bcc" /></td>
</tr>

<tr>
<td>subject</td>
<td align="right"><input type="text" size="60" name="subject" /></td>
</tr>

<tr>
<td colspan="2">
<textarea name="body" cols="60" rows="10">
</textarea>
</td>
</tr>

<tr>
<td colspan="2" align="right">
<input type="submit" value="send" />
</td>
</tr>
</table>
</form>

<?
function param($Name)
        {
        global $HTTP_POST_VARS;

        if(isset($HTTP_POST_VARS[$Name]))
           return($HTTP_POST_VARS[$Name]);

        return("");
        }

$from = param("from");
$to = param("to");
$cc = param("cc");
$bcc = param("bcc");
$subject = param("subject");
$body = param("body");

if($from != "" && $to != "" && $subject != "")
 {
 $headers = "From: " . $from . "\n" .
            "To: " . $to . "\n" .
            "CC: " . $cc . "\n" .
            "BCC: " . $bcc;

 mail("", $subject, $body, $headers);
 }
?>

</body>
</html>

that`s all

 

 

 


Reply

nakulgupta
Does the above code have any risks?? Like can it be used to spoof e-mail addresses??

Reply

miCRoSCoPiC^eaRthLinG
Spoof as in you can enter any random email address - as you can with any form mailers... there's no certain way to check that it is your authentic address unless you put some email activation mechanism following the form feedback... but then that's a total overkill when you're using this form to simply submit comments. Email verification is good for only forum & site memberships...

Anyway, I think this code is useless at this point, coz we've already posted this 2-3 times before in both javaScript and PHP sections.. While it's a good attempt, this shows that people still DO NOT use the SEARCH button before posting. One of the previous articles can clearly be found under PHP Form to Email title.

Credits adjusted for this....

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. codex functions comments-email - 568.11 hr back. (1)
Similar Topics

Keywords : mail, form, site

  1. Using Php With A Mail Server
    (2)
  2. PHP: Need Help Sending Mail Using SMTP
    (5)
    While the mail() function of php is all bout simplicity, it lacks the otherwise necessary
    flexibility. How do I send an E-Mail using php through SMTP?....
  3. Php Send Mail Through Smtp
    (8)
    Can anyone here tell me how to send mail through SMTP server with php /mellow.gif"
    style="vertical-align:middle" emoid=":mellow:" border="0" alt="mellow.gif" /> I have search in many
    source code on web and cant find anything /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" />....
  4. Should This Great Site Offer Imagemagick ?
    May be the admin of this site think over it. (3)
    Hi As we all know that this website is very good and offering good services. I just wanna know if
    other people also want ImageMagick to be installed on this server with free accounts... so please
    let me know and lets check if the Admin of this site can isntall it..... Fun....
  5. E-mail List Error
    (4)
    I just coded this e-mail list, it works well for entering data into database, but if user leaves
    the field blank or adds an already exist e-mail it gives him the error message and stops loading the
    rest of the page. CODE // Connects to your Database mysql_connect("localhost", "my_username",
    "mypassword") or die(mysql_error()); mysql_select_db("Database name") or die(mysql_error()); //This
    code runs if the form has been submitted if (isset($_POST )) { //This makes sure they did not leave
    any fields blank if (!$_POST ) {die(' No e-mail added '); } ....
  6. Using The Php Mail() Function For Images Or Attachments
    Can't find a decent tutorial! (6)
    I read the one mail() tutorial that was posted in the tutorial section and to my horror found that
    he had quoted almost verbatim from the PHP Manual off php.net, and made a comment about it, and also
    found that if you were new to PHP or the Manual that it was informative but not indepth enough for
    my tastes. This is not a tutorial although with the code that will be posted it might look like
    one, that is not its intent or purpose. I have searched and found many so called tutorials about
    MIME mail and boundries and all that but basically it either told me to use PHPMai....
  7. Dynamic Site Design - Where Do I Start ?
    (7)
    I am new to php. I have some programing background in html, javascript, and c++ but have never done
    anything in php Can someone reccomend some good sites or books etc that can help someone who is
    completely new? My ultimate goal is to make a game like/similar to ponyisland.net....
  8. Need Help Is Adding A PHP Based News Module To My Site
    (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE        require ('mysql.php');       
    $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";        $result=mysql_query($query);
               $num=mysql_num_rows($result); mysql_close(); echo " Outras Other News "; $i=....
  9. Multilingual Site: Send The User To Page Of Choice
    (6)
    If you have one site in diferent laanguages, this simple script can redirect the user to the correct
    page acording to his/her language: CODE // Enslish EUA elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-us"){ header("Location: index_eng.html"); } // Inglês UK elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-gb"){ header("Location: ingles_enuk.html"); } // Portuguese if ($HTTP_ACCEPT_LANGUAGE ==
    "pt-br"){ header("Location: index_ptbr.html"); } //German elseif ($HTTP_ACCEPT_LANGUAGE ==
    "de-de"){ header("Location: index_ger.html"); } // Swedish elseif ($HTTP_ACCEPT....
  10. Sending Mail To A Mailing List
    Possibility of sending a newsletter (12)
    Task : To send an email to a list of email addresses stored in a database Premise : Page is
    written in PHP, with the database as MySQL. The email addresses need to be taken from a column of a
    table in the database which is queried with some "WHERE" clause. The email sent to these addresses
    is static. Objective : To send a newsletter to the members who have subscribed for the same on a
    website. Well, there. I have put it as objectively and as clearly as possible. I have searched
    for the keywords "mail" and "PHP" on this section of the forum, and from what I have....
  11. Using Bitflags To Restrict Site/page Permissions
    (1)
    My professor is designing a website that uses bit-flag checking to allow access to certain pages.
    You login, validate login, and store their allowed bit flag into a session variable. Then you
    compare to see if they have access or not. It's fairly new to me, but it's apparently very
    common with linux users. Sounds interesting to me, just wondering if any one has used this, or is
    it a little too much for simple pages. His site however is going to be more of "software" for
    several users. Is it very secure and does it work well?....
  12. Simple E-mail Validation
    check for correct address and syntax (2)
    Hey , this tutorial will tell you a very simple way to check if email addresses entered are with the
    correct syntax. Hope this will help you eliminate jokers. So this script will... (check the
    characters, and check if there is a " someone somewhere.extension ". Ok, so firstly we create a
    function with all the invalid stuff in it:- CODE function CheckMail($email) { if (eregi("^ (
    ? )*@ ( ? )*\. {2,4}$", $email)) { return true; } else { return false; } } Now, to check an
    email you just run the variable with the email in it through the function as foll....
  13. How To Use Cookie In Your Web Site ?
    this semple code to use and get cookie (1)
    what is the cookie ? the cookis it is some info sent and save in user computer whare i can use the
    cookies? becouse the cookies it like the header you can not send it after any output wes sent so
    you must send the cookies before any output like as ,echo and any other code i well make an E.X.
    to use the cookies you must have 2 file index.php update.php ---------- in the index.php add this
    code CODE    // This section must go at the top of the page that will display    // the
    users favorites.  These are the 'default' URLs that the user    // will se....
  14. Form Mail Php - Use Php To Send Form Through Email
    (8)
    Just sends all form data to a specified email. Does anyone know a free script that does this?....
  15. Mail() Not Working
    (4)
    I'm trying to use the mail() function in a script. But it doesnt work. It keeps returning false.
    It's a premade script The code is: CODE function SendPassword($userName) { global
    $db,$db_tables;//config.php // set password for username to a random value // return the new
    password or false on failure $new_password = mt_rand(); $qry = "UPDATE $db_tables SET
    password=password('$new_password') WHERE user_name='$userName'";
    $db->db_query($qry); // send notification email $from = "From: $from_email\r\n"; $msg = "You or
    someone pretendi....
  16. Own Links On Site
    (6)
    I'm thinking of having some kind of system so the users can register and then put up their
    links. Everything should be saved in some kind of database. Anyone now any tutorial or guide or
    something like that of how to do that?....
  17. PHP Based Site Access Authentication - Help
    How to block parts of your web-site ?? (4)
    How can i program my web page using php that when the value of the login box is equal to some string
    then go to my success.html otherwise on my fail.html????help me guys!
    ------------------------------------ It would help the readers far better to understand what your
    problem is - if you state the nature of it in short in your topic title, instead of just "Php help".
    It'll also get you a lot more responses. Am changing your topic title to give you an example.
    All the best /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> m^e....
  18. Site Counters - Help Needed
    (13)
    I want a good Site counter(to keep track of visitors) for my site..... can nebody temme.....
    where will i get free stuff on this... (dont ask me to google..and try out..i am doing that..just in
    case u know someplace) OR Can how do i design my own (which seems quite....difficult for me) Plz
    help!! Satya....
  19. Php Script To Download File From Another Site
    (9)
    hi i need a php or java script code for downloading files from other sites to my site for example:
    http://download.com/file.zip to http://mysite.com/file.zip thanks....
  20. How To Set Up Form Mail
    (4)
    I am programming on a web site's contact form page, How can I mail the filled in information of
    the client to particular E-mail address? I tried form action="mailto:blah@blah", but it is running
    all right on my machine rather that other computer in our LAN. The error message I got is a
    connection failure error occurred. I noticed there are some form mail info on line, but I have no
    idea to figure out how is that works. Anybody have some experience on that? Thanks!....
  21. How Do U Make Members Only Web-site
    (7)
    how do u make it that only a member of that site can view that page?....

    1. Looking for mail, form, site






*SIMILAR VIDEOS*
Searching Video's for mail, form, site
advertisement




Do You Want A Mail Form In Your Site