authenticating to smtp server / cdo

  • Thread starter Thread starter anony
  • Start date Start date
A

anony

Hi,

I'm trying to use system.web.mail to send an email, but the smtp server
requires authentication. I cam across some info about extra fields allowed
via the following:

Dim mail As New MailMessage()
mail.To = "(e-mail address removed)
mail.From = "(e-mail address removed)"
mail.Subject = "this is a test email."
mail.Body = "Some text goes here"

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenti
cate", "1") 'basic authentication

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername
", "username") 'set your username here

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword
", "password") 'set your password here
SmtpMail.SmtpServer = "smtp.domain.com" 'your real server goes here
SmtpMail.Send(mail)


Unfortunatley, I get a compilation error:

'Fields' is not a member of 'System.Web.Mail.MailMessage'

Can anyone shed some light on how to send mail through an smtp server that
requires authentication?

Thanks much,
Brian
 
Use .Net Framework 1.1 instead of 1.0 and you shouldn't receive this error anymore
 

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

Back
Top