Page 1 of 1

How to Submit Form Data to an Email Address

Posted: Sun Jul 29, 2012 3:07 am
by Gertie Kawleweski

does someone have a code put together for submitting form data to an email address?


How to Submit Form Data to an Email Address

Posted: Sun Jul 29, 2012 3:32 am
by maxkatz

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


How to Submit Form Data to an Email Address

Posted: Tue Aug 28, 2012 12:13 pm
by Matt Shiells-Jones

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:a href="mailto:me@me.com" rel="nofollow"me@me.com/a"
+ "&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:
a href="mailto:me@me.com" rel="nofollow"me@me.com/a&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.


How to Submit Form Data to an Email Address

Posted: Tue Aug 28, 2012 2:12 pm
by maxkatz

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

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

The format is like this:
a href="mailto:me@me.com" rel="nofollow"me@me.com/a?subject=...&body=....


How to Submit Form Data to an Email Address

Posted: Sun Sep 02, 2012 12:29 pm
by Matt Shiells-Jones

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?


How to Submit Form Data to an Email Address

Posted: Sun Sep 02, 2012 6:48 pm
by maxkatz

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:a href="mailto:name@email.com" rel="nofollow"name@email.com/a and see if that works.

Support for all other parameter might be different on different platforms/browsers.