unable to relay with vb.net system.mail

C

Chris Thunell

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
(e-mail address removed)
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 = "(e-mail address removed)" '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)
 
J

John Timney \(ASP.NET MVP\)

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
 
C

Chris Thunell

Do you have a Microsoft article that tells me how to do that?
Chris Thunell
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top