title: How could I recreate a PHP mail script in ASP?
body: <p>I'm trying to create a simple, completely stand-alone ASP script that reads GET variables posted from a jQuery ajax call and then sends an email based on some of those values. However, I am completely new to ASP and having some trouble converting it.</p>
  
  <p>From my research, it appears that the ASP equivalent of $_GET['var_name'] is Request.QueryString['var_name']. However, with sending an email, I have stumbled across dozens and dozens of examples using everything from ASPEmail, CDOSYS, IPWorksMail, JMail, and so on. I have tried a few and I tend to get no positive results.</p>
  
  <p>Here is what I'm trying to accomplish in ASP, written in PHP:</p>
  
  <pre><code>&lt;?php
    if($_GET['val1'] != "") {
      // Add section one to the email.
    }
  
    if($_GET['val2'] != "") {
      // Add section two to the email
    }
  
    $email_company = mail($_GET['company_email'], $subject, $message, $headers);
    $email_client = mail($_GET['client_email'], $subject, $message, $headers);
  
    if($email_company &amp;&amp; $email_client) {
      echo 'success';
    }
    else {
      echo 'error';
    }
  
  ?&gt;
  </code></pre>
  
  <p>So, what should I be looking to use for emails? Can I made this page standalone, so that it can sit by itself and receive AJAX calls? Thank you for your time.</p>
  
  <p>EDIT:</p>
  
  <p>I have been trying stuff like this and I without fail get a 500 server error. I cannot view any error messages as all I get is a 500 page, so I don't know where to look for the problem.</p>
  
  <pre><code>&lt;%=
  
  
  ' Create the Mail Message
  Dim Mail As New MailMessage
  
  ' Set the address information
  Mail.From = New MailAddress("from@website.com") 
  Mail.To.Add("to@website.com")
  
  ' Set the content of the email
  Mail.Subject = "Testing Email"
  Mail.Body = "Hello, I am a test email!"
  
  ' Send the message
  Dim SMTP As New SmtpClient("MAIL SERVER")
  SMTP.EnableSsl = False
  SMTP.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSSWORD")
  SMTP.Port = 25
  
  SMTP.Send(Mail)
  
  
  
  %&gt;
  </code></pre>