473,394 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

unable to relay with vb.net system.mail

I am using the following code to send email out in a vb.net web program
through an exchange 2003 server. My web server is on a separate server.
When i try to send email inside the office, it works fine... but when i try
to send email outside the company i get "unable to relay" error message.
Please look at the code, i don't see a way to send username and password
credentials to allow the relaying to occur (I don't want unauthenticated
relaying to be allowed, because that would open our system up for outsiders
to relay as well). Both the web server and exchange are within our
organzation. Any thoughts?
Thanks in advance!
Chris Thunell
ct******@pierceassociates.com
Imports System.Web

Imports System.Web.Mail
Dim message As New MailMessage

Dim Attachment As System.Web.Mail.MailAttachment

With message

..BodyFormat = MailFormat.Html

..To = "ct******@pierceassociates.com" 'RecipientList

..Cc = MessageFrom

..Subject = MessageSubject

..From = MessageFrom

..Body = MessageBody

If Len(Trim(AttachmentLocation)) > 1 Then

Attachment = New MailAttachment(Trim(AttachmentLocation))

..Attachments.Add(Attachment)

End If

End With

SmtpMail.SmtpServer = "myemailserver.domain.com"

SmtpMail.Send(message)
Nov 19 '05 #1
3 2408
There doesn't look to be anything wrong with your code, so your mail admin
should be able to set a rule in your mail server to allow relays from the
web servers IP address without compromising the ability to stop relays from
outside the company

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I am using the following code to send email out in a vb.net web program
through an exchange 2003 server. My web server is on a separate server.
When i try to send email inside the office, it works fine... but when i try to send email outside the company i get "unable to relay" error message.
Please look at the code, i don't see a way to send username and password
credentials to allow the relaying to occur (I don't want unauthenticated
relaying to be allowed, because that would open our system up for outsiders to relay as well). Both the web server and exchange are within our
organzation. Any thoughts?
Thanks in advance!
Chris Thunell
ct******@pierceassociates.com
Imports System.Web

Imports System.Web.Mail
Dim message As New MailMessage

Dim Attachment As System.Web.Mail.MailAttachment

With message

.BodyFormat = MailFormat.Html

.To = "ct******@pierceassociates.com" 'RecipientList

.Cc = MessageFrom

.Subject = MessageSubject

.From = MessageFrom

.Body = MessageBody

If Len(Trim(AttachmentLocation)) > 1 Then

Attachment = New MailAttachment(Trim(AttachmentLocation))

.Attachments.Add(Attachment)

End If

End With

SmtpMail.SmtpServer = "myemailserver.domain.com"

SmtpMail.Send(message)

Nov 19 '05 #2
Do you have a Microsoft article that tells me how to do that?
Chris Thunell
ct******@pierceassociates.com

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
There doesn't look to be anything wrong with your code, so your mail admin
should be able to set a rule in your mail server to allow relays from the
web servers IP address without compromising the ability to stop relays from outside the company

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I am using the following code to send email out in a vb.net web program
through an exchange 2003 server. My web server is on a separate server.
When i try to send email inside the office, it works fine... but when i

try
to send email outside the company i get "unable to relay" error message.
Please look at the code, i don't see a way to send username and password
credentials to allow the relaying to occur (I don't want unauthenticated
relaying to be allowed, because that would open our system up for

outsiders
to relay as well). Both the web server and exchange are within our
organzation. Any thoughts?
Thanks in advance!
Chris Thunell
ct******@pierceassociates.com
Imports System.Web

Imports System.Web.Mail
Dim message As New MailMessage

Dim Attachment As System.Web.Mail.MailAttachment

With message

.BodyFormat = MailFormat.Html

.To = "ct******@pierceassociates.com" 'RecipientList

.Cc = MessageFrom

.Subject = MessageSubject

.From = MessageFrom

.Body = MessageBody

If Len(Trim(AttachmentLocation)) > 1 Then

Attachment = New MailAttachment(Trim(AttachmentLocation))

.Attachments.Add(Attachment)

End If

End With

SmtpMail.SmtpServer = "myemailserver.domain.com"

SmtpMail.Send(message)


Nov 19 '05 #3
Chris,
I've run into this exact issue, and it is indeed the mail server's
settings. If your mail server is IIS, check out any of the articles
returned by this simple google search:
http://www.google.com/search?sourcei...urity+mail+IIS

Regardless, this is a mail server issue, not ASP.NET.

--
Best regards,
Jeffrey Palermo
Blog: http://dotnetjunkies.com/weblog/jpalermo
"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:OF**************@tk2msftngp13.phx.gbl...
Do you have a Microsoft article that tells me how to do that?
Chris Thunell
ct******@pierceassociates.com

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
There doesn't look to be anything wrong with your code, so your mail admin should be able to set a rule in your mail server to allow relays from the web servers IP address without compromising the ability to stop relays

from
outside the company

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I am using the following code to send email out in a vb.net web program through an exchange 2003 server. My web server is on a separate server. When i try to send email inside the office, it works fine... but when i
try
to send email outside the company i get "unable to relay" error

message. Please look at the code, i don't see a way to send username and password credentials to allow the relaying to occur (I don't want unauthenticated relaying to be allowed, because that would open our system up for

outsiders
to relay as well). Both the web server and exchange are within our
organzation. Any thoughts?
Thanks in advance!
Chris Thunell
ct******@pierceassociates.com
Imports System.Web

Imports System.Web.Mail
Dim message As New MailMessage

Dim Attachment As System.Web.Mail.MailAttachment

With message

.BodyFormat = MailFormat.Html

.To = "ct******@pierceassociates.com" 'RecipientList

.Cc = MessageFrom

.Subject = MessageSubject

.From = MessageFrom

.Body = MessageBody

If Len(Trim(AttachmentLocation)) > 1 Then

Attachment = New MailAttachment(Trim(AttachmentLocation))

.Attachments.Add(Attachment)

End If

End With

SmtpMail.SmtpServer = "myemailserver.domain.com"

SmtpMail.Send(message)



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nader | last post by:
Hello all, Any help would be greatly appreciated. In a Web-based application (server is local) I am trying to send an email from the server side by The error occurs at the following line...
2
by: Jinsong Liu | last post by:
I need to using System.Web.Mail to send out notifications from my ASP.NET application. Based on what I know, a relay enabled SMTP server is required. Is there any way I can use a SMTP server which...
2
by: Rene | last post by:
Hi all i need some help. i try to send mail with the following code. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim...
3
by: Chris Thunell | last post by:
I am using the following code to send email out in a vb.net web program through an exchange 2003 server. My web server is on a separate server. When i try to send email inside the office, it works...
1
by: nate.strules | last post by:
I've looked everywhere for an answer to this, but only a few people seem to have encountered it. The code is straightforward: MailMessage mail = new MailMessage(from, to, subject, body);...
1
by: Martin Pöpping | last post by:
Hello, I´m having a problem with the mail-method. It throws me an exeption and says: Mailbox unavailable. The server response was: 5.7.1 Unable to relay I´ve changed the server...
7
by: Dave Hardenbrook | last post by:
I am new to ASP.NET (only coded web pages in HTML in the past), and I'm having some trouble: I have a form on which a visitor to my page can fill out comments and send them to my E-mail box. The...
1
by: Benedict Verheyen | last post by:
Hi, i get an "Unable to relay for" when trying to send an email from within my network to an email address not on my domain. I don't understand why it says "relaying" as i'm sending from an...
5
by: Carmine [www.thetotalsite.it] | last post by:
Hi everyone, I get a really odd error while using SMTPClient.Send() function in ASP.Net. The error is the following: Dim smtp As New Net.Mail.SmtpClient("smtp.thetotalsite.it", 25) Dim bodyMSG...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.