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)
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)