title: Sending An Email From a .html Page via Calling A .aspx.vb
body: <p>I have, hopefully a small, issue that you can help with.</p>
  
  <p>I have an Email.html page which asks the user to enter an email address to which I want to send an email too:</p>
  
  <pre><code>&lt;section id="dialog" class="window"&gt;
  &lt;h1&gt;Email Me &lt;a href="#" class="close"/&gt;Close&lt;/a&gt;&lt;/h1&gt;  
  </code></pre>
  
  <p></p>
  
  <pre><code>  &lt;p&gt;Email Details To&lt;/p&gt;
      &lt;input type="email" placeholder="email address" autofocus class="input-    email" id="email"&gt;
  
    &lt;p id="email-entry" class="error disp-none"&gt;Please enter an email address&lt;/p&gt;
    &lt;p id="email-valid" class="error disp-none"&gt;Please enter a valid email address&lt;/p&gt;
  
    &lt;input type="button" value="Send" id="btn-send"&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>I have an aspx.vb file which I hoped that would ‘take care’ of the emailing:</p>
  
  <pre><code>Imports System.Net.Mail
  
  Partial Class ContactUs
  Inherits System.Web.UI.Page
  
  Protected Sub SendMails_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendMails.Click
  
  Dim FromPersonName As String = FromName.Text
      Dim FromPersonEmail As String = “sales@test.co.uk”
      Dim FromPersonContactNumber As String = FromContactNumber.Text
      Dim EmailSubject As String = Subject.Text
      Dim ToAddress As String = email.input
  
      '(1) Create the MailMessage instance
      Dim mm As New MailMessage(FromEmail.Text, ToAddress)
  
      '(2) Assign the MailMessage's properties
      mm.Subject = Subject.Text
      mm.Body = "Thank you for your enquiry. A member of our team will contact you shortly.”
      mm.IsBodyHtml = False
  
      '(3) Create the SmtpClient object
      Dim smtp As New SmtpClient
  
      '(4) Send the MailMessage (will use the Web.config settings)
      smtp.Send(mm)
  
      EmailSentForm.Visible = True
      SendMails.Visible = False
  
  End Sub
  End Class
  </code></pre>
  
  <p>Finally, a web.config file that access my server:</p>
  
  <pre><code>&lt;system.net&gt;
      &lt;mailSettings&gt;
          &lt;smtp&gt;
              &lt;!--    &lt;network host="yourRELAYSERVERHOSTNAME" port="yourPORTNUMBER" userName="yourUSERNAME" password="yourPASSWORD" /&gt; --&gt;
  
          &lt;/smtp&gt;
      &lt;/mailSettings&gt;
  &lt;/system.net&gt;
  </code></pre>
  
  <p>How can I integrate these file together (if possible), so when a user enters there email address in the .html page, the .aspx.vb script is called and the web.config?</p>
  
  <p>Is there an easier solution to what I am trying to achieve?</p>
  
  <p>Any help appreciated, thanks.</p>