I’m amused

How to Submit Form Data to an Email Address

does someone have a code put together for submitting form data to an email address?
2 people have
this question
+1
This topic is no longer open for comments or replies.
  • Max Katz (Official Rep) July 29, 2012 03:32
    Instead of traditional forms, REST API services are used via an Ajax request. As for sending an email, you can use mailto: -- that will launch the native mail client. If you want to send emails via REST API, you can use SendGrid API:

    http://blog.tiggzi.com/2012/06/sendgr...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I too have the same query, but differently - the issue is that I am using the mailto as follows;

    var restbookdate = $('input[dsid="restbookdate"]');
    var restbookname = $('input[dsid="restbookname"]');
    var roomnumber = $('input[dsid="roomnumber"]');
    var time = $('input[dsid="time"]');
    var numberpeople = $('input[dsid="numberpeople"]');
    var comments = $('input[dsid="comments"]');

    var link = "mailto:me@me.com"
    + "&subject=" + escape("Restaurant Booking Request - Bedroom "&roomnumber.val())
    + "&body=" + escape("This is a restaurant booking request as below \n" + "Room Number:"&roomnumber.val())
    ;

    window.location.href=link

    so basically I have to get variables from the form and then pass them to the email program, but when i try the above, i get all the subject etc added to the email address so i end up with the email address being:
    me@me.com&subject=0&body=0

    so it is not pulling the variables from the form, and also is not setting the email address and subject and body etc as i require? what am i doing wrong here?

    This needs to be from the native application email program, NOT a rest api or similar; this is because the form is processed automatically by an internal program.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • var restbookdate = $('input[dsid="restbookdate"]'); will give you a jQuery Mobile component, not the actual value. This will give you the value:


    var restbookdate = $('input[dsid="restbookdate"]').val();


    The format is like this:
    me@me.com?subject=...&body=....
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • what if i wanted to send emails using my own server direct from the form instead of using the sendgrid api?

    this is because despite changing the values etc as above, the mail app does does not load - even when trying an alert, nothing happens when i click the send button - app bug perhaps but nothing at all seems to work on the button?
    • You can use any other provider that offers mail API.

      The approach that you tried is pretty much sending an email through your own server. This approach is not much different than composing an email in whatever mail program you use on your phone.

      Try this on button click:
      mailto:name@email.com and see if that works.

      Support for all other parameter might be different on different platforms/browsers.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned