Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 922777 - Last Review: May 11, 2007 - Revision: 1.3
You receive an error message when you try to send an e-mail message by using the System.Web.Mail namespace in the .NET Framework 1.0
When you try to send an e-mail message by using the
System.Web.Mail namespace in the Microsoft .NET Framework 1.0, you receive the following error message:
0x80040220 - The 'SendUsing' configuration value is invalid
This issue occurs after you try to use the
String.Insert method to change the
SmtpMail.SmtpServer property. For example, the issue occurs when you try to send an e-mail message after you use code that resembles the following:
SmtpMail.SmtpServer.Insert(0, "mail.mycompany.com");
This issue occurs because the
String.Insert method does not change the value of the
SmtpMail.SmtpServer property. Therefore, the value of the
SmtpMail.SmtpServer property is null.
Note If you try to send an e-mail message by using the
System.Web.Mail namespace on the same computer that is running the Simple Mail Transfer Protocol (SMTP) server, you may not receive the error message because the e-mail message is sent to the pickup directory of the local SMTP server.
To resolve this issue, you must specifically assign the value of the SMTP server that you are using to send the e-mail message. Assign the value to the
SmtpMail.SmtpServer property directly. For example, use code that resembles the following:
SmtpMail.SmtpServer = "mail.mycompany.com";
For more information about how to send e-mail programmatically by using the System.Web.Mail namespace, click the following article numbers to view the articles in the Microsoft Knowledge Base:
314201Â
(http://kbalertz.com/Feedback.aspx?kbNumber=314201/
)
How to send e-mail programmatically with System.Web.Mail and Visual Basic .NET
310273Â
(http://kbalertz.com/Feedback.aspx?kbNumber=310273/
)
How to send e-mail programmatically by using System.Web.Mail in Visual C# 2005 or in Visual C# .NET
Note Some third-party Internet Web sites have incorrect information about how to use the
String.Insert method with the
SmtpMail.SmtpServer property. For information about the correct usage, see the Microsoft .NET Framework documentation.
For more information about how to use the
System.Web.Mail namespace and the
SmtpMail class to send e-mail messages, visit the following Microsoft Web sites:
APPLIES TO
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
| kbtshoot kbnofix kbprb KB922777 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate