Sending EMail in iis7 ASP page

Author Message
marka

  • Total Posts : 2
  • Scores: 0
  • Reward points : 810
  • Joined: 3/28/2011
  • Status: offline
Sending EMail in iis7 ASP page Monday, April 04, 2011 3:08 PM (permalink)
0
Hello,
     I have been working for a week on trying to send an e-mail out of a iis7 ASP page. I have researched and researched on the Internet for code. No matter what code I use I always get a message saying "500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed." Here is a listing of what I was trying to use mostly. Can someone please help me get the right code to use on a SBS 2008 IIS7 computer? Thank you.

Mark B. Avis

<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">

Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

  'Create an instance of the MailMessage class
  Dim objMM as New MailMessage()

  'Set the properties - send the email to the person who filled out the
  'feedback form.
  objMM.To = "webmaster@yoursite.com"
  objMM.From = txtEmail.Text

  'If you want to CC this email to someone else, uncomment the line below
  'objMM.Cc = "someone@someaddress.com"

  'If you want to BCC this email to someone else, uncomment the line below
  'objMM.Bcc = "someone@someaddress.com"

  'Send the email in text format
  objMM.BodyFormat = MailFormat.Text
  '(to send HTML format, change MailFormat.Text to MailFormat.Html)

  'Set the priority - options are High, Low, and Normal
  objMM.Priority = MailPriority.Normal

  'Set the subject
  objMM.Subject = "Feedback"

  'Set the body
  objMM.Body = "At " + DateTime.Now + " feedback was sent from an ASP.NET " & _
               "Web page.  Below you will find the feedback message " & _
               "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
               "---------------------------------------" & vbCrLf & vbCrLf & _
               txtMessage.Text & vbCrLf

 
  'Specify to use the default Smtp Server
  SmtpMail.SmtpServer = ""
 
  'Now, to send the message, use the Send method of the SmtpMail class
  SmtpMail.Send(objMM)


  panelSendEmail.Visible = false
  panelMailSent.Visible = true
End Sub

</script>

<html>
<body>
  <asp:panel id="panelSendEmail" runat="server">
    <form runat="server">
      <h2>We are interested in your feedback!  Please enter the following
      requested information below to send us your comments.</h2>

      <b>Your Name:</b>
      <asp:textbox id="txtName" runat="server" />
      <br>

      <b>Your Email Address:</b>
      <asp:textbox id="txtEmail" runat="server" />
      <p>

      <b>Your Message:</b><br>
      <asp:textbox id="txtMessage" TextMode="MultiLine"
                      Columns="40" Rows="10" runat="server" />
      <p>

      <asp:button runat="server" id="btnSendFeedback" Text="Send Feedback!"
                  OnClick="btnSendFeedback_Click" />
    </form>
  </asp:panel>


  <asp:panel id="panelMailSent" runat="server" Visible="False">
    An email has been sent to the email address you specified.  Thanks!
  </asp:panel>
</body>
</html>
 
#1
    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 2 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2013 ASPPlayground.NET Forum Version 3.9