The topic covered in this post actually have applicability beyond Lotus Notes, but that is just where I ran into the problem.  The real subject is adding credentials to your SMTP client.  Normally I would just make sure that the service sending the email has permission to send email to an Exchange server.  The problem I had to send the email through Lotus and it wanted a separate login from the identity running the program. 

The only error message I got back when I originally wrote the code without specifying a user name and password was that my code had violate a policy.  How helpful.

Now this isn’t rocket science, but finding information on this subject can be difficult at times.  Note in the code sample below that it is adding a NetworkCredential object to the SMTP client. 

// Format the email body
emailBody = emailBody.Replace("$$WEBSITE$", website).Replace("$$NAME$", NameText.Text).Replace("$$ADDRESS$", AddressText.Text)
.Replace("$$STATE$", StateDropDownList.SelectedValue).Replace("$$COUNTRY$", CountryDropDownList.SelectedValue)
.Replace("$$ZIP$", ZipText.Text).Replace("$$PHONE$", PhoneText.Text).Replace("$$EMAIL$", EmailText.Text);

SmtpClient client = new SmtpClient(host);
client.Credentials = new System.Net.NetworkCredential(credentialName, credentialPwd);

MailMessage message = new MailMessage(fromEmail, toEmail, subject, emailBody);


The thing that amazed me was that even though the class you need to use is called NetworkCredentials it seems to be more appropriate to call it mail server credentials.  I was able to put in a Lotus user ID and password that was separate from the any existing network ID and it picked up the authentication properly.  Hopefully this helps someone else avoid the same pain in the future.