Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   unable to relay with vb.net system.mail (http://www.velocityreviews.com/forums/t92479-unable-to-relay-with-vb-net-system-mail.html)

Chris Thunell 12-09-2004 06:42 PM

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
cthunell@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 = "cthunell@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)



John Timney \(ASP.NET MVP\) 12-09-2004 07:25 PM

Re: unable to relay with vb.net system.mail
 
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" <cthunell@pierceassociates.com> wrote in message
news:%23AsOk7h3EHA.3616@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
> cthunell@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 = "cthunell@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)
>
>




Chris Thunell 12-09-2004 08:44 PM

Re: unable to relay with vb.net system.mail
 
Do you have a Microsoft article that tells me how to do that?
Chris Thunell
cthunell@pierceassociates.com

"John Timney (ASP.NET MVP)" <timneyj@despammed.com> wrote in message
news:uv2K1Si3EHA.3452@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" <cthunell@pierceassociates.com> wrote in message
> news:%23AsOk7h3EHA.3616@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
> > cthunell@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 = "cthunell@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)
> >
> >

>
>




Jeffrey Palermo [MCP] 12-10-2004 12:18 AM

Re: unable to relay with vb.net system.mail
 
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" <cthunell@pierceassociates.com> wrote in message
news:OFrJr$i3EHA.2572@tk2msftngp13.phx.gbl...
> Do you have a Microsoft article that tells me how to do that?
> Chris Thunell
> cthunell@pierceassociates.com
>
> "John Timney (ASP.NET MVP)" <timneyj@despammed.com> wrote in message
> news:uv2K1Si3EHA.3452@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" <cthunell@pierceassociates.com> wrote in message
> > news:%23AsOk7h3EHA.3616@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
> > > cthunell@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 = "cthunell@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)
> > >
> > >

> >
> >

>
>





All times are GMT. The time now is 01:26 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.