#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

    Question How to make E-Mail sender in HTML ??


    Hi,

    I want HTML code with which we can send E-Mail. I googled it and i got this code:

    <a href="mailto:saipraveenmylavarapu@gmail.com">Your Text Here</a>

    But I want a code with text boxes in which we can enter From address, To address and text which is e-mail body (comment).

    Can anyone give me that code please ???

    Thanks in advance!
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    HTML is not capable of sending E-Mail. You need to combine it with a server side language like PHP, ASP.NET, Python, Ruby, etc.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    85
    Rep Power
    3
    take a look at this

    http://www.w3schools.com/php/func_mail_mail.asp

    Comments on this post

    • sir_drinxalot disagrees : http://www.w3fools.com
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

    Lightbulb Code


    Can u give me that php code please.....

    Also code to attach php in HTML
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    85
    Rep Power
    3
    What you need to do is make a form for the user to fill out. This form should include the fields you want.

    The important bit of this html is the action, method and the names of the fields

    Code:
    <form name="mail" action="send_mail.php" method="post">
    <input type="text" name="name" />
    <input type="text" name="email" />
    <input type="text" name="comment" />
    <input type="submit" value="Submit">
    </form>

    The php code as you saw on the link I gave you is

    Code:
    mail(to,subject,message,headers,parameters)
    So what you need to do is, to take the names of the input fields and place them into that line of code. The file is in this example called send_mail.php

    Code:
    <?php
    
    $yourMail = "your@email.com"; //The email address you want to receive mails on
    
    //stuff from the html form
    $name = $_POST['name'];  //Grap the name from the name field
    $email = $_POST['email'];  //Grap the email from the email field
    $comment = $_POST['comment']; //Grap the comment from the comment field
    
    //the magic part
    mail($yourMail, $name, $email. $comment);
    
    ?>
    THIS IS JUST AN EXAMPLE for you to understand
    Now please notice that it would be a really bad idea to use this code, since it is vulnerable to injections. So you would want to do something in the lines off

    http://www.w3schools.com/php/php_secure_mail.asp
  10. #6
  11. Known to taste like chicken
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    In front of my computer
    Posts
    399
    Rep Power
    312
    w3schools is not the best place to learn from, they tend to teach a lot of bad habits.
    "Take thy beak from out my heart, and take thy form from off my door" - Homer J Simpson / Edgar Allan Poe

    Looking for a project Idea?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    85
    Rep Power
    3
    Originally Posted by sir_drinxalot
    w3schools is not the best place to learn from, they tend to teach a lot of bad habits.
    True! Does it answer his question yes it does.

    If you want to elaborate on escape methods, be my guest. Chances are high that he will get confused
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0
    Thanks for your code. It is nice
  16. #9
  17. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Location
    Ludhiana
    Posts
    33
    Rep Power
    0
    You'll find a lot of help online on w3schools, quackit, php.net, stackoverflow, etc

    I still recommend ASP.net because they have predefined functions that you would simply need to customize.

IMN logo majestic logo threadwatch logo seochat tools logo