Thursday, March 29, 2012

Newbie - Problem Sending an email via .NET

Hello,
I am tring to send an email from my local machine (acting as a web server)
on my company's network.
For simplicity sake, I just want to send an email to myself. But I cannot
seem to configure this correctly. Either nothing happens at all, no errors
and no email, but the code seems to run OK, or I get an error saying it
cannot find the Server.
Here's the code:
Public Shared Sub SendEmailToMe()
Dim from As String = "myself@dotnet.itags.org.here.com
Dim mailto As String = "myself@dotnet.itags.org.here.com"
Dim subject As String = "Test Message"
Dim body As String = "Test the body message"
SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I think
is my SMTP is, but I'm not sure
SmtpMail.Send(from, mailto, subject, body)
End Sub
My assumption is that I do not have the SMTPServer configured correctly. But
that is just a guess.
Any insight is greatly appreciated.
Thanks.
-RobTry :
http://support.microsoft.com/default.aspx?scid=kb;en-us;308161
"Rob G" <gumbatman@.hotmail.com> a crit dans le message de
news:10doikcrc0sgsc4@.corp.supernews.com...
> Hello,
> I am tring to send an email from my local machine (acting as a web server)
> on my company's network.
> For simplicity sake, I just want to send an email to myself. But I cannot
> seem to configure this correctly. Either nothing happens at all, no errors
> and no email, but the code seems to run OK, or I get an error saying it
> cannot find the Server.
> Here's the code:
>
> Public Shared Sub SendEmailToMe()
> Dim from As String = "myself@.here.com
> Dim mailto As String = "myself@.here.com"
> Dim subject As String = "Test Message"
> Dim body As String = "Test the body message"
> SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I
think
> is my SMTP is, but I'm not sure
> SmtpMail.Send(from, mailto, subject, body)
> End Sub
> My assumption is that I do not have the SMTPServer configured correctly.
But
> that is just a guess.
> Any insight is greatly appreciated.
> Thanks.
> -Rob
>
>
>Public Shared Sub SendEmailToMe()
> Dim from As String = "myself@.here.com
>Dim mailto As String = "myself@.here.com"
>Dim subject As String = "Test Message"
>Dim body As String = "Test the body message"
>SmtpMail.SmtpServer = "localhost" 'I've tried my IP address and what I thin
k
>is my SMTP is, but I'm not sure
>SmtpMail.Send(from, mailto, subject, body)
>End Sub
>My assumption is that I do not have the SMTPServer configured correctly. Bu
t
>that is just a guess.
>Any insight is greatly appreciated.
>Thanks.
>-Rob
>
Where does it exception? What is the exception message?, do you have
the iis smtp relay server running? Can you see the mail anywhere in
inetpub/mailroot/?
-Adam
Just now, I found the emails in the C:\Inetpub\mailroot\Queue directory.
<ashelley@.inlandkwpp.com> wrote in message
news:l3jod0peeo7b9q0bcdfv43515v28l250pe@.
4ax.com...
think
But
> Where does it exception? What is the exception message?, do you have
> the iis smtp relay server running? Can you see the mail anywhere in
> inetpub/mailroot/?
> -Adam
ashelley,
Here's some other stuff I found:
Since I have the SMTP Server running, I no longer get the exception errors.
I walked through the steps to Test Windows 2000 IIS SMTP Services Manually
as per http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
and everything seemed to check out. However, that mail that I sent, when
testing, is still sitting in the Queue directory.
I guess the next step is to figure out why it is not moving from the Queue
to an actual email.
Thanks for your help.
-Rob
<ashelley@.inlandkwpp.com> wrote in message
news:l3jod0peeo7b9q0bcdfv43515v28l250pe@.
4ax.com...
think
But
> Where does it exception? What is the exception message?, do you have
> the iis smtp relay server running? Can you see the mail anywhere in
> inetpub/mailroot/?
> -Adam
On Fri, 25 Jun 2004 12:40:46 -0400, "Rob G" <gumbatman@.hotmail.com>
wrote:

>ashelley,
>Here's some other stuff I found:
>Since I have the SMTP Server running, I no longer get the exception errors.
>I walked through the steps to Test Windows 2000 IIS SMTP Services Manually
>as per http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
>and everything seemed to check out. However, that mail that I sent, when
>testing, is still sitting in the Queue directory.
>I guess the next step is to figure out why it is not moving from the Queue
>to an actual email.
>Thanks for your help.
>-Rob
>
Since you tested it and it is delivering mail by telnetting to it I
think you might need to look at a few things. delete the stuff in the
queue directory, and just try resending. make sure you use the same
email credentials you used while testing. if you use the same
credentials and it doesn't work maybe it is having problems with
permisions on the directories within mailroot. if it keeps failing,
drive a hammer through the front of your screen and go out and enjoy
the sun.
-Adam
ashelley,
Thanks for your help. I think we are getting closer.
It seems that these queued emails are in the Outbox of Outlook Express (I
expected them to be in Outlook). I can't send anything from Outlook Express
because it wants a dialup connection. I would like it to connect to my LAN,
but I can't figure that one out.
Another hour on this and I am going out into the sun and get some fresh air.
-Rob
<ashelley@.inlandkwpp.com> wrote in message
news:58lod01ogm3ig5s9viuedctdjodqj1k21p@.
4ax.com...
> On Fri, 25 Jun 2004 12:40:46 -0400, "Rob G" <gumbatman@.hotmail.com>
> wrote:
>
errors.
Manually
http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
Queue
> Since you tested it and it is delivering mail by telnetting to it I
> think you might need to look at a few things. delete the stuff in the
> queue directory, and just try resending. make sure you use the same
> email credentials you used while testing. if you use the same
> credentials and it doesn't work maybe it is having problems with
> permisions on the directories within mailroot. if it keeps failing,
> drive a hammer through the front of your screen and go out and enjoy
> the sun.
> -Adam
>
On Fri, 25 Jun 2004 13:03:58 -0400, "Rob G" <gumbatman@.hotmail.com>
wrote:

>ashelley,
>Thanks for your help. I think we are getting closer.
>It seems that these queued emails are in the Outbox of Outlook Express (I
>expected them to be in Outlook). I can't send anything from Outlook Express
>because it wants a dialup connection. I would like it to connect to my LAN,
>but I can't figure that one out.
>
yeah, umm okay, i assume you mean .eml files. They open in outlook
express because of a file association not because they are sent out
using outlook. I'm not particularly sure, in detail, how the relay
thing works.
What i think might be happenning is that it can't send email to the
domain you are trying to send to. are there any logs in
system32/logfiles/ that help us out?
-Adam
Hi Rob,
Outlook/Outlook Express has nothing to do with sending emails from a Net
app. It is a client program which connects to a POP3 server, or Exchange
Server in order to send emails. The .Net app uses an SMTP server, which you
already know you have on your machine. Don't get them .
If the email you're sending has a return address which is not local to your
machine, by default, the IIS SMTP server disallows "relaying," which is,
simply, the transmission of an email which did not originate on that machine
(determined by the return email address's domain name). You may need to
configure your local SMTP server to allow relaying. Be aware, however, that
it is turned off for a reason. You may find SPAMmers using your local SMTP
Server, unless you've blocked incoming traffic on Port 25.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Rob G" <gumbatman@.hotmail.com> wrote in message
news:10domo0217j5l85@.corp.supernews.com...
> ashelley,
> Thanks for your help. I think we are getting closer.
> It seems that these queued emails are in the Outbox of Outlook Express (I
> expected them to be in Outlook). I can't send anything from Outlook
Express
> because it wants a dialup connection. I would like it to connect to my
LAN,
> but I can't figure that one out.
> Another hour on this and I am going out into the sun and get some fresh
air.
> -Rob
> <ashelley@.inlandkwpp.com> wrote in message
> news:58lod01ogm3ig5s9viuedctdjodqj1k21p@.
4ax.com...
> errors.
> Manually
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;286421#Task1
when
> Queue
>
Kevin,
This is what I've done so far:
Under Default SMTP Virtual Server I went to Properties.
Clicked the Access tab.
Clicked Relay.
I added my local computer's IP address and 127.0.0.1 (just to test becuase I
don't know what I am doing).
"Only the list below " is selected and so is "Allow all computer which
succesfully authenticate..."
Does that make any sense?
Thanks.
-Rob
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ulogESuWEHA.3596@.tk2msftngp13.phx.gbl...
> Hi Rob,
> Outlook/Outlook Express has nothing to do with sending emails from a Net
> app. It is a client program which connects to a POP3 server, or Exchange
> Server in order to send emails. The .Net app uses an SMTP server, which
you
> already know you have on your machine. Don't get them .
> If the email you're sending has a return address which is not local to
your
> machine, by default, the IIS SMTP server disallows "relaying," which is,
> simply, the transmission of an email which did not originate on that
machine
> (determined by the return email address's domain name). You may need to
> configure your local SMTP server to allow relaying. Be aware, however,
that
> it is turned off for a reason. You may find SPAMmers using your local SMTP
> Server, unless you've blocked incoming traffic on Port 25.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
> "Rob G" <gumbatman@.hotmail.com> wrote in message
> news:10domo0217j5l85@.corp.supernews.com...
(I
> Express
> LAN,
> air.
> when
>

0 comments:

Post a Comment