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

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

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

    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. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    There's no function that allows javascript to send an email.
    However, you could use AJAX to request a page that does send an email in eg. PHP.
     
    Sky AK47, Oct 3, 2011 IP
  3. happyhosting

    happyhosting Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The mail need to be sent with the help of a server which javascript cannot do. It has to be combined with server side script.
     
    happyhosting, Oct 3, 2011 IP
  4. sparek

    sparek Peon

    Messages:
    68
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Javascript is a client-side programming language. This means that when it is executes in the browser, it is the website visitor's browser that is executing this code. This is why you see some javascript code work for one browser and not for another, it depends on how each browser parses the code.

    Javascript doesn't provide a way to send out mail, because it is a client-side language. Even if you could write a way to send mail with javascript, it would likely only work for one client, unless all of your clients have exactly (exact mirrors) the same system setup, using the same ISP, using the same outgoing mailserver, using the same authentication credentials, etc.

    As others have said, you would need a server-side programming language to send out mail. Perhaps something with PHP. Perhaps using an AJAX request to connect a javascript to a PHP script on a server.
     
    sparek, Oct 3, 2011 IP
  5. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #5

    there's no Javascript mail function, what you can do is create a mail form then send it via ajax then the mail function is processed server-side (i.e. PHP)
     
    JohnnySchultz, Oct 4, 2011 IP