473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

What am I doing wrong? System.Net.Mail

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!

Dec 21 '06 #1
11 3434
<ju*************@yahoo.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.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...
Dec 21 '06 #2
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.
Any good links for this?

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.
I think the problem is on the iis or exchange server side

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:
<ju*************@yahoo.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.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...
Dec 22 '06 #3
<ju*************@yahoo.comwrote in message
news:11*********************@42g2000cwt.googlegrou ps.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...?
Dec 22 '06 #4
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:
<ju*************@yahoo.comwrote in message
news:11*********************@42g2000cwt.googlegrou ps.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...?
Dec 22 '06 #5
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)

<ju*************@yahoo.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.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!

Dec 22 '06 #6
Thanks! I'll be sure to check it out!

sloan wrote:
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)

<ju*************@yahoo.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.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!
Dec 22 '06 #7
<ju*************@yahoo.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
>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.
Like I said, I'm almost certain that's not the problem, but a quick ping
test will prove it...
>Are you using McAfee Anti-Virus software...?

Yep, we sure are
Thought so.
Are their issues with McAfee and System.Net.Mail?
Yep.
http://www.google.co.uk/search?sourc...Mail%22+McAfee
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)
McAfee is the problem, not your firewall. Its access protection is
preventing your webserver communicating out on port 25. Do the following on
your webserver:

1) right click on Virus Scan and go to the Virus scan console
2) click on Access Protection, Properties
3) in Port Blocking select Prevent mass mailing worms from sending email,
and click Edit
4) in Excluded Processes add the exe file which is trying to send the
email - for ASP.NET, it's w3wp.exe
5) save out of the dialog

If your McAfee is centrally managed using ePolicy Orchestrator, you'll need
to set it in there too, otherwise it will just overwrite your webserver's
settings.
Also, I was wondering, is the smtp host supposed to be the exchange
server or the web server?
Depends whether you want to use your Exchange server to send the emails or
your webserver - if your webserver, you'll need to enable its SMTP queue.
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?
No - relaying is something different.
Dec 22 '06 #8
McAfee is the problem, not your firewall. Its access protection is
preventing your webserver communicating out on port 25. Do the following on
your webserver
You are truly amazing Mark! I'm sure this is what the problem is.
Unfortunately we're shut down for the weekend for Christmas, but at
least my mind can rest now!

Merry Christmas and Thanks a ton!
Mark Rae wrote:
<ju*************@yahoo.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
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.

Like I said, I'm almost certain that's not the problem, but a quick ping
test will prove it...
Are you using McAfee Anti-Virus software...?
Yep, we sure are

Thought so.
Are their issues with McAfee and System.Net.Mail?

Yep.
http://www.google.co.uk/search?sourc...Mail%22+McAfee
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)

McAfee is the problem, not your firewall. Its access protection is
preventing your webserver communicating out on port 25. Do the following on
your webserver:

1) right click on Virus Scan and go to the Virus scan console
2) click on Access Protection, Properties
3) in Port Blocking select Prevent mass mailing worms from sending email,
and click Edit
4) in Excluded Processes add the exe file which is trying to send the
email - for ASP.NET, it's w3wp.exe
5) save out of the dialog

If your McAfee is centrally managed using ePolicy Orchestrator, you'll need
to set it in there too, otherwise it will just overwrite your webserver's
settings.
Also, I was wondering, is the smtp host supposed to be the exchange
server or the web server?

Depends whether you want to use your Exchange server to send the emails or
your webserver - if your webserver, you'll need to enable its SMTP queue.
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?

No - relaying is something different.
Dec 22 '06 #9
<ju*************@yahoo.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
You are truly amazing Mark!
No - just experienced... :-) The McAfee problem is one that I have
encountered with several clients, including one of my current ones, so it's
found its way into my personal knowledge base. Now it's in yours too...:-)
I'm sure this is what the problem is.
It certainly *sounds* likely, and would be the first thing I would look at,
but there are several other possible causes of mail transport failure...
Dec 22 '06 #10
Mark, I just got back to work after the Christmas break and tried your
suggestions. You were 100 percent correct with your diagnosis,
everything is now working perfectly!

Thanks again for sharing your time and expertise!
Mark Rae wrote:
<ju*************@yahoo.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
You are truly amazing Mark!

No - just experienced... :-) The McAfee problem is one that I have
encountered with several clients, including one of my current ones, so it's
found its way into my personal knowledge base. Now it's in yours too...:-)
I'm sure this is what the problem is.

It certainly *sounds* likely, and would be the first thing I would look at,
but there are several other possible causes of mail transport failure...
Dec 27 '06 #11
<ju*************@yahoo.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Mark, I just got back to work after the Christmas break and tried your
suggestions. You were 100 percent correct with your diagnosis,
everything is now working perfectly!
Hurrah!
Thanks again for sharing your time and expertise!
No problem.
Dec 27 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
5
by: Franco, Gustavo | last post by:
Hi, I have a question, and please I need a answer. How can I finalize a thread running with Application.Run (I need the message loop!!!) without call Thread.Abort?. I want to call...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
4
by: tfsmag | last post by:
It acts like it sends, but nothing ever shows up... anything you guys can find glaringly wrong here? Thanks in advance, Jeff Here is the code that is supposed to send the mail. ...
3
by: Andrew | last post by:
Hi, friends, I have a function which send email with attachments as the follows: public int SendEmailWithAttachment(string fromEmailAddress, string toEmailAddress, string subject, string...
9
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in...
4
by: shapper | last post by:
Hello, I am trying to send an email from a form in my web page. I have the following codes: ... Dim mailSettings As New System.Net.Configuration.MailSettingsSectionGroup Dim smtpClient As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.