troubleshooting Question

ASP.NET Send E-Mail Via Exchange 2007 Relay IP

Avatar of brasso_42
brasso_42 asked on
4 Comments3 Solutions422 ViewsLast Modified:

Im trying to send an e-mail via out Exchange 2007 server, but I get an error saying that it cant send.  If I change the IP to an exchange 2003 server it works fine.

I know the relay is setup properly on my 2007 server as I use it for another app I wrote using access 2007.

The Code Im using is below



Form Code

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm5.aspx.vb" Inherits="Blaze_Billz.WebForm5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
  <form id="form1" runat="server">
      From:<br />
      <asp:TextBox ID="txtFromAddress" runat="server" Columns="35" /></p>
      To:<br />
      <asp:TextBox ID="txtToAddress" runat="server" Columns="35" /></p>
      Subject:<br />
      <asp:TextBox ID="txtSubject" runat="server" Columns="50" /></p>
      Body:<br />
      <asp:TextBox ID="txtBody" runat="server" Columns="75" TextMode="MultiLine" Rows="6" /></p>
      <asp:Button ID="btnSend" runat="server" Text="Send Mail" /></p>


   Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSend.Click

        Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()

        mailMessage.From = New System.Net.Mail.MailAddress(txtFromAddress.Text.Trim())
        mailMessage.To.Add(New System.Net.Mail.MailAddress(txtToAddress.Text.Trim()))
        mailMessage.Priority = Net.Mail.MailPriority.High

        mailMessage.Subject = txtSubject.Text.Trim()
        mailMessage.Body = txtBody.Text.Trim()

        Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()

    End Sub

Web.config settigns

      <smtp from="">
        <network host="" password="" userName="" />
Dustin Hopkins
Senior Web Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros