SMTP and Secure Password Authentication (SPA)

C

Cedric Fairweather

I need help sending messages to mail systems that requre SPA. Here is a code
snippit but it does not work. Thanks in advance for your help.
Cedric

Dim Mail As New System.Net.Mail.MailMessage
Mail.From = New MailAddress(FromEMailAddress, FromName)
Mail.To.Add(New MailAddress(SendTo))
Mail.Subject = Subject
Mail.Body = body
Dim Smtp = New SmtpClient(SMTPServer, SMTPPort) 'SMTPServer =
smtp.somewhere.com
Dim nc As New NetworkCredential

If String.IsNullOrEmpty(SmtpUserID) = False Then
If String.IsNullOrEmpty(SmtpPassword) = False Then
Smtp.Credentials = New Net.NetworkCredential(SmtpUserID, SmtpPassword)
End If
End If

If UseSSL Then
Smtp.EnableSsl = True
End If

If UseSPA Then
nc = New Net.NetworkCredential(SmtpUserID, SmtpPassword)
'AuthTypes: "Basic", "NTLM", "Digest", "Kerberos", "Negotiate" string
authType = "Basic"
Smtp.Credentials = nc.GetCredential(SMTPServer, SMTPPort, "NTLM")
ELSE

End If

Smtp.Send(Mail)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top