473,503 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MailSettings code generates VS2005 error in web.config

Hi all,
Here's a good one. I'm just trying to set up simple email configuration in
web.config so that I can move my site from my development machine to the
production server. I didn't need to pass an ID and Password to the smtp
server at my office, but the Web server I'm using requires it. So I look
into the online help and find no samples of how to set up that type of
configuration. All examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod="network">...
"The deliverymethod attribute is invalid - the value 'network' is invalid
according to its datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling
teeth with .NET.
Instead of getting productive work done, I will now be researching another
cryptic VS error message.
What did I do wrong? Does anyone know?

Thanks for any help.

Apr 30 '07 #1
3 6734
Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod="network" from="jo***@powerlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Kotuby" <jo***@powerlist.comwrote in message news:eB*************@TK2MSFTNGP04.phx.gbl...
Hi all,
Here's a good one. I'm just trying to set up simple email configuration in web.config so that I
can move my site from my development machine to the production server. I didn't need to pass an ID
and Password to the smtp server at my office, but the Web server I'm using requires it. So I look
into the online help and find no samples of how to set up that type of configuration. All examples
assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod="network">...
"The deliverymethod attribute is invalid - the value 'network' is invalid according to its
datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling teeth with .NET.
Instead of getting productive work done, I will now be researching another cryptic VS error
message.
What did I do wrong? Does anyone know?

Thanks for any help.


Apr 30 '07 #2
Thanks Juan...
Yes I am using ASP.NET 2.0

But good old Intellisense came to the rescue right after my rant.
The accepted syntax is:
<smtp deliveryMethod="Network">

Isn't that a hoot? Just capitalize Network in it gets accepted.

But during my research I found out that back in May 2006 there was a bug in
System.Net.Mail

If you were hard coding the credentials and used the syntax...

UseDefaultCredentials = false

The ID and Password you coded would be ignored and not sent to the smtp
server.
The fix was to NOT refer to UseDefaultCredentials because it is false by
default.

Maybe this bit of information will help somebody else if the bug has not yet
been fixed.

So to be safe I am leaving...
defaultCredentials="false"
Out of my web.config for the time being.

Thanks again...

P.S. My apologies, I sent the first reply back to you directly and just
corrected my mistake.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eU*************@TK2MSFTNGP05.phx.gbl...
Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod="network" from="jo***@powerlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Kotuby" <jo***@powerlist.comwrote in message
news:eB*************@TK2MSFTNGP04.phx.gbl...
>Hi all,
Here's a good one. I'm just trying to set up simple email configuration
in web.config so that I can move my site from my development machine to
the production server. I didn't need to pass an ID and Password to the
smtp server at my office, but the Web server I'm using requires it. So I
look into the online help and find no samples of how to set up that type
of configuration. All examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod="network">...
"The deliverymethod attribute is invalid - the value 'network' is invalid
according to its datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling
teeth with .NET.
Instead of getting productive work done, I will now be researching
another cryptic VS error message.
What did I do wrong? Does anyone know?

Thanks for any help.





Apr 30 '07 #3
re:
!Isn't that a hoot? Just capitalize Network in it gets accepted.

Sometimes it's the little things which trip us.

:-)

re:
!The fix was to NOT refer to UseDefaultCredentials because it is false by default.

Interesting.

re:
!Maybe this bit of information will help somebody else if the bug has not yet been fixed.

I'm sure it will.
Thanks for posting the heads-up!

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Kotuby" <jo***@powerlist.comwrote in message news:u6**************@TK2MSFTNGP05.phx.gbl...
Thanks Juan...
Yes I am using ASP.NET 2.0

But good old Intellisense came to the rescue right after my rant.
The accepted syntax is:
<smtp deliveryMethod="Network">

Isn't that a hoot? Just capitalize Network in it gets accepted.

But during my research I found out that back in May 2006 there was a bug in
System.Net.Mail

If you were hard coding the credentials and used the syntax...

UseDefaultCredentials = false

The ID and Password you coded would be ignored and not sent to the smtp
server.
The fix was to NOT refer to UseDefaultCredentials because it is false by
default.

Maybe this bit of information will help somebody else if the bug has not yet
been fixed.

So to be safe I am leaving...
defaultCredentials="false"
Out of my web.config for the time being.

Thanks again...

P.S. My apologies, I sent the first reply back to you directly and just corrected my mistake.
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eU*************@TK2MSFTNGP05.phx.gbl...
>Might not be meaningful, but you're missing a parameter ...

<smtp deliveryMethod="network" from="jo***@powerlist.com">

You *are* running an ASP.NET 2.0 app, aren't you ?
This only works in ASP.NET 2.0...


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Kotuby" <jo***@powerlist.comwrote in message news:eB*************@TK2MSFTNGP04.phx.gbl...
>>Hi all,
Here's a good one. I'm just trying to set up simple email configuration in web.config so that I
can move my site from my development machine to the production server. I didn't need to pass an
ID and Password to the smtp server at my office, but the Web server I'm using requires it. So I
look into the online help and find no samples of how to set up that type of configuration. All
examples assume default network credentials.

I find the code below in VS help and copy it into my web.config.

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="network">
<network
host="localhost"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Now I get an error on the line <smtp deliveryMethod="network">...
"The deliverymethod attribute is invalid - the value 'network' is invalid according to its
datatype 'NmToken' - the enumeration constraint failed."

It seems that very often even the simplest of tasks can be like pulling teeth with .NET.
Instead of getting productive work done, I will now be researching another cryptic VS error
message.
What did I do wrong? Does anyone know?

Thanks for any help.






Apr 30 '07 #4

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

Similar topics

2
1143
by: gorden blom | last post by:
Hi, I'm a student who's working on a school project about ASP.NET / C#. I'm having some problems with my class. I want to create an ArrayList filled with results from a DataReader. It gives me...
0
1152
by: Lloyd Dupont | last post by:
Hi! I'm a newbie ;-) I started to write an excessively simple ASP.NET "utility" web app, named WebSite1. Inside of it I'm using FreeTextBox (http://www.freetextbox.com) Then I modified the...
2
1307
by: VB Programmer | last post by:
When I change my "from" and "host" I get a slew of web.config messages... Here's the mailsettings... <system.net> <mailSettings> <smtp from="me@mydomain.com"> <network host="mail.mydomain.com"...
40
2756
by: GTi | last post by:
Is there any source code documentation tools available for Visual Studio 2005 ? I have created a LIB that must be documented. Must I do it by hand or is it some kind of tools to pre document my...
2
2040
by: Rob Dob | last post by:
Hi, How do I go about installing another Web Site Project inside my existing VS2005 website project. I currently have both a forum WSP and my main WSP application within the same solution. Both...
1
1366
by: Franklin M. Gauer III | last post by:
In VS2003 I used to be able to drag a SQL Server table from Server Explorer onto my webservice (in design mode) and it would automatically create a DataAdapter for me. This doesn't work in VS2005...
10
1719
by: Ivan Vecerina | last post by:
Here's a relatively simple code snippet: #include <memory> class Base { public: Base(); virtual ~Base(); virtual void f(int a, char const* name);
3
3651
by: David Prentice | last post by:
I am having dificulty debugging an ASP.NET Ajax (Novemver CTP) app on windows vista RTM. I have found the following interesting facts but cannot join the dots . . If my application is...
0
2460
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all I have an app.config file for my App, and use MailSettings Section. I can modify AppSettings and ConnectionsStrings , and then save app.config.
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
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
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
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
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.