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.