For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > December 2006 > What am I doing wrong? System.Net.Mail









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author What am I doing wrong? System.Net.Mail
justsome_newbie@yahoo.com

2006-12-21, 7:07 pm

Hello experts! I'm trying to send mail from my C# Asp.Net webpage. I
used the code samples at www.systemnetmail.com but it still won't send.
I think the problem is on the iis or Exchange server side but I can't
find any tutorials on how to configure the server(s). Any good links
for this?

Any advice is welcome!

Mark Rae

2006-12-21, 7:07 pm

<justsome_newbie@yahoo.com> wrote in message
news:1166743433.743559.56530@79g2000cws.googlegroups.com...

> but it still won't send.


That really doesn't tell us much...

> I think the problem is on the iis or Exchange server side


What makes you think that...?

> but I can't find any tutorials on how to configure the server(s).


Er, well can your webserver see the Exchange server? What account are you
using? Does it require authentication?

> Any good links for this?


http://www.systemnetmail.com

> Any advice is welcome!


You could start by showing us your code...


justsome_newbie@yahoo.com

2006-12-21, 7:07 pm

Sorry, it's my first post, I didn't know what all you needed. I'll try
to answer you're questions better this time.

>
> http://www.systemnetmail.com


This is what I was using, I actually took the the sample directly from
the "How do I send a simple Html email?" section (changing the email
addresses and host name). I tried using both the IP address and the
actual name of the Exchange server but neither worked.

>
> What makes you think that...?


I figured that since I used the code on the systemnetmail.com page that
the code was fine, meaning the problem must be with iis or exchange. I
could easily be wrong though, I've never used the System.Net.Mail
classes and have no iis/exchange experience (this is my first asp.net
project)

> Er, well can your webserver see the Exchange server? What account are you
> using? Does it require authentication?


How do I check if my webserver can see the Exchange server? Our network
admin said that no authenication is required, but I still tried using
"smtp.Credentials = new NetworkCredential("userid", "password");" with
a valid username and password and it still failed.

> That really doesn't tell us much...


It throws a System.Net.Mail.SmtpException with message "Failure to send
mail" with an inner exeption System.Web.MailException with message
"Unable to connect to the remote server"

Thanks for you help so far! Hopefully this post is clearer than my last
one.

Thanks Again!

Mark Rae wrote:
> <justsome_newbie@yahoo.com> wrote in message
> news:1166743433.743559.56530@79g2000cws.googlegroups.com...
>
>
> That really doesn't tell us much...
>
>
> What makes you think that...?
>
>
> Er, well can your webserver see the Exchange server? What account are you
> using? Does it require authentication?
>
>
> http://www.systemnetmail.com
>
>
> You could start by showing us your code...


Mark Rae

2006-12-21, 10:06 pm

<justsome_newbie@yahoo.com> wrote in message
news:1166746761.348455.30990@42g2000cwt.googlegroups.com...

> Sorry, it's my first post, I didn't know what all you needed. I'll try
> to answer you're questions better this time.


That's OK. For the future, the following would really help us to help you
i.e. you'd probably get an anwer much more quickly...:-)

1) Make the subject of your post descriptive

2) Briefly mention the software you're using - that's especially important
if you're not using the latest versions, because we'll assume you are unless
you say you're not.

3) Explain what you're trying to do

4) Describe how you've tried to do it

5) If you're getting errors, tell us what they are - the more information,
the better.

6) Provide as much of the code as is relevant - especially the bits where
the error occurs... :-)

> This is what I was using, I actually took the the sample directly from
> the "How do I send a simple Html email?" section (changing the email
> addresses and host name). I tried using both the IP address and the
> actual name of the Exchange server but neither worked.


OK.

> I figured that since I used the code on the systemnetmail.com page that
> the code was fine, meaning the problem must be with iis or exchange. I
> could easily be wrong though, I've never used the System.Net.Mail
> classes and have no iis/exchange experience (this is my first asp.net
> project)


From what you've said, I doubt very much that there is a problem with your
Exchange server - if there was, your network admin would already know about
it.

> How do I check if my webserver can see the Exchange server?


Well, first things first. Log on to the webserver and try to ping the
Exchange server. I'm assuming (because you have not said the contrary) they
both servers are on the same network.

> Our network admin said that no authenication is required, but I still
> tried using
> "smtp.Credentials = new NetworkCredential("userid", "password");" with
> a valid username and password and it still failed.


Hmm - OK...

> It throws a System.Net.Mail.SmtpException with message "Failure to send
> mail" with an inner exeption System.Web.MailException with message
> "Unable to connect to the remote server"


Ah! Now we're getting somewhere... :-) That message doesn't *necessarily*
indicate that the webserver can't actually connect to the remote server (but
do the ping test just to be sure), but certainly does indicate that
*something* is getting in the way of the mail process.

Are you using McAfee Anti-Virus software...?


justsome_newbie@yahoo.com

2006-12-21, 10:06 pm

Thanks again for your time, here's some more answers!

> Well, first things first. Log on to the webserver and try to ping the
> Exchange server. I'm assuming (because you have not said the contrary) they
> both servers are on the same network.


Unfortunately, I've already left work so I'll have to wait to try
pinging the exchange server. And you are correct, they both are on the
same network. If it helps the website communicates fine with our SQL
server so I know some things are going through fine.

> Are you using McAfee Anti-Virus software...?


Yep, we sure are (boy you're smart). Are their issues with McAfee and
System.Net.Mail? If it helps I did ask our Net Admin if there were any
firewalls that might be blocking the mail. He said that there wasn't
any that would block communications on the inside. (its an intranet
only app)

Also, I was wondering, is the smtp host supposed to be the exchange
server or the web server? I read somewhere that iis is supposed to
relay the email message - does that mean that the web server's iis is
supposed to send the email to the exchange server? Again, sorry if I'm
completely wrong here, I'm really lost when it comes to iis and
exchange.

Thanks again for all your help!


Mark Rae wrote:
> <justsome_newbie@yahoo.com> wrote in message
> news:1166746761.348455.30990@42g2000cwt.googlegroups.com...
>
>
> That's OK. For the future, the following would really help us to help you
> i.e. you'd probably get an anwer much more quickly...:-)
>
> 1) Make the subject of your post descriptive
>
> 2) Briefly mention the software you're using - that's especially important
> if you're not using the latest versions, because we'll assume you are unless
> you say you're not.
>
> 3) Explain what you're trying to do
>
> 4) Describe how you've tried to do it
>
> 5) If you're getting errors, tell us what they are - the more information,
> the better.
>
> 6) Provide as much of the code as is relevant - especially the bits where
> the error occurs... :-)
>
>
> OK.
>
>
> From what you've said, I doubt very much that there is a problem with your
> Exchange server - if there was, your network admin would already know about
> it.
>
>
> Well, first things first. Log on to the webserver and try to ping the
> Exchange server. I'm assuming (because you have not said the contrary) they
> both servers are on the same network.
>
>
> Hmm - OK...
>
>
> Ah! Now we're getting somewhere... :-) That message doesn't *necessarily*
> indicate that the webserver can't actually connect to the remote server (but
> do the ping test just to be sure), but certainly does indicate that
> *something* is getting in the way of the mail process.
>
> Are you using McAfee Anti-Virus software...?


sloan

2006-12-21, 10:06 pm

http://sholliday.spaces.live.com/blog/

I have some smtp samples there. 1.1 and 2.0.

You need to also check the authenication method.

(none, basic or ssl)



<justsome_newbie@yahoo.com> wrote in message
news:1166743433.743559.56530@79g2000cws.googlegroups.com...
> Hello experts! I'm trying to send mail from my C# Asp.Net webpage. I
> used the code samples at www.systemnetmail.com but it still won't send.
> I think the problem is on the iis or Exchange server side but I can't
> find any tutorials on how to configure the server(s). Any good links
> for this?
>
> Any advice is welcome!
>



justsome_newbie@yahoo.com

2006-12-21, 10:06 pm

Thanks! I'll be sure to check it out!

sloan wrote:[color=darkred]
> http://sholliday.spaces.live.com/blog/
>
> I have some smtp samples there. 1.1 and 2.0.
>
> You need to also check the authenication method.
>
> (none, basic or ssl)
>
>
>
> <justsome_newbie@yahoo.com> wrote in message
> news:1166743433.743559.56530@79g2000cws.googlegroups.com...

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com