how to create a java script mail function..........

Discussion in 'JavaScript' started by dineshsingh1984, Oct 3, 2011.

  1. #1
    how to create a java script mail function..........
    I am using some script which are findout to google but no anyone script are working.........

    so plz help me......
     
    dineshsingh1984, Oct 3, 2011 IP
  2. SheetalCreation

    SheetalCreation Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #2
    Directly you don't have any mail function in js like php have. but you can create a form and in the form action you can provide mailto like following :


    [SIZE=+1]<form action="mailto:you@yourdmainhere.com" method="post" enctype="text/plain" > FirstName:<input type="text" name="FirstName"> Email:<input type="text" name="Email"> <input type="submit" name="submit" value="Submit"> </form>[/SIZE]

    sheetal
     
    SheetalCreation, Oct 5, 2011 IP
  3. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #3
    javascript has no ability to send mail or have a mail function.. it's always on the server-side
     
    JohnnySchultz, Oct 6, 2011 IP
  4. developer.designer

    developer.designer Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Javascript is Client Side Language it doesn't allow you to send email
     
    developer.designer, Oct 8, 2011 IP
  5. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #5
    A mailto: link will open the user's email program (assuming they have a default email program set) with the data you included in the link - your email address, the information they entered on the form, any hard-coded text you include.

    If you want a form they just fill out and click, you have to use server-side code (PHP, ASP or Cold Fusion) to get the data from the user, then send the email. There are two possible problems here:

    1) If you do it in Javascript, your email address is exposed on the site. Email address harvesters look for those emails. That address will become unusable due to spam very quickly.

    2) If you do it on the server, your host must allow the mail function (some have it effectively disabled), and must provide an SMTP server, or you have to send the email through another SMTP server (like your Google email account).
     
    Rukbat, Oct 8, 2011 IP
  6. yho_o

    yho_o Well-Known Member

    Messages:
    354
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    #6
    you can not send emails with javascript, but you still can submit your data with jquery to php file which sends the email
     
    yho_o, Oct 11, 2011 IP