0

How to send email by .net, with ajax-jquery requests ?

I am new to .net so dont really know how to do it, but i dont think it is a long code, can anyone help me ?

HTML

 <form action="" method="get" id="mapKontaktForm" onsubmit="return false;">
      <input type="text" value="Indtask dit navn" />
      <input type="text" value="Indtask dit tlf. nr." />
      <input type="text" value="Indtask dit post nr." />
      <input type="submit" value="Send" id="mapFormSubmit" onclick="return false;" />
 </form>

jquery-ajax

$('#mapFormSubmit').click(
                function(){
var name = $('#mapKontaktForm input:nth-child(1)').val();
var phone = $('#mapKontaktForm input:nth-child(2)').val();
var post = $('#mapKontaktForm input:nth-child(3)').val();

var dataString = 'name='+ name + '&phone=' + phone + '&post=' + post;  

$.ajax({  
    type: "GET",  
    url: "/files/billeder/../Templates/Designs/Ideal2011/js/contactForm.aspx",  
    data: dataString,  
    success: function() { 
           $('.acceptBox').fadeIn(1000); 
         },
         error: function(){
               $('.errorBox').fadeIn(1000);  
          }
    });  
    return false;
}

)

What should be in aspx or ashx file to send these three values by email ?

Vilius
  • 65
  • 1
  • 1
  • 6

1 Answers1

0

you have to read the values from the QueryString object and send it with help of the smtp classes from c#

look here for howto send a mail: http://www.codegod.biz/WebAppCodeGod/Send-eMail-System-Net-Mail-Smtp-C-AID58.aspx

Fender
  • 3,055
  • 1
  • 17
  • 25