I was pleasantly surprised to see the traffic analytics on a post I wrote a while ago on Using jQuery to Send Email with Web Services. However, I found some who were still requiring assistance writing the actual .NET web service. Here you go.
In Visual Studio, when you create a web service (ASMX), the default format is SOAP. You will need add a couple of attributes to the code to make it return results in a true JSON format.
- First requirement is that you do a POST, but the AJAX call already takes care of that.
- Your class is going to need the
- Your method responsible for sending mail will need this attribute:
[ScriptMethod(UseHttpGet = false,ResponseFormat = ResponseFormat.Json)]