So I'm trying to teach myself asp.net along with javascript. I downloaded a website template and converted it to an asp site. It has a contact form which the javascript called a php function to send an email. I can't use php to send email on my hosting site.
The template included a file MailHandler.ashx
that I should be able to use to send mail with asp. I have done my research, and I believe I have this code in working order. My question is, where the javascript used to call the PHP file, how do I convert that to call this MailHandler file?
This is the relevant code calling my php file:
$.ajax({
type: "POST",
url:_.mailHandlerURL, //this value is the path to the php file
data:{
name:_.getValFromLabel($('.name',_.form)),
email:_.getValFromLabel($('.email',_.form)),
phone:_.getValFromLabel($('.phone',_.form)),
fax:_.getValFromLabel($('.fax',_.form)),
state:_.getValFromLabel($('.state',_.form)),
message:_.getValFromLabel($('.message',_.form)),
owner_email:_.ownerEmail,
stripHTML:_.stripHTML
},
I understand that this is invoking a post method to the php file, so how do I invoke a post method do my Mailhandler file?
This is my handler file:
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
//create mail client, create message, send email
}
}