brasso_42
asked on
ASP.NET Send E-Mail Via Exchange 2007 Relay IP
Hi
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
Thanks
Brasso
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
Thanks
Brasso
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>
From:<br />
<asp:TextBox ID="txtFromAddress" runat="server" Columns="35" /></p>
<p>
To:<br />
<asp:TextBox ID="txtToAddress" runat="server" Columns="35" /></p>
<p>
Subject:<br />
<asp:TextBox ID="txtSubject" runat="server" Columns="50" /></p>
<p>
Body:<br />
<asp:TextBox ID="txtBody" runat="server" Columns="75" TextMode="MultiLine" Rows="6" /></p>
<p>
<asp:Button ID="btnSend" runat="server" Text="Send Mail" /></p>
</div>
</form>
</body>
</html>
VB COde
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()
smtpClient.Send(mailMessage)
End Sub
Web.config settigns
<system.net>
<mailSettings>
<smtp from="">
<network host="192.168.17.1" password="" userName="" />
</smtp>
</mailSettings>
</system.net>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
After some more testing it works fine if I use basic authentication. It seems a bit buggy, but it will do as is for now.
Thanks for your help
Brasso