This article has been archived. It is offered "as is" and will no longer be updated.
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:
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 How to send e-mail programmatically with System.Web.Mail and Visual Basic .NET
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: