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

Discussion in 'ASP .Net' started by techie, May 11, 2004.

  1. techie

    techie Guest

    I'm trying to use system.web.mail to send an email, but the smtp
    server
    requires authentication. I came across some info about fields
    property

    Dim mail As New MailMessage()
    mail.To = "
    mail.From = ""
    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)


    I get a compilation error:

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

    Even though I have installed .Net Framework 1.1, i am not able to
    compile the code. Can anybody help me on this.
    Thanks in advance.
    Techie
     
    techie, May 11, 2004
    #1
    1. Advertising

  2. techie

    Phil Wilson Guest

    If you are using VS.NET, that might be the problem. It's using the 1.0
    framework.
    --
    Phil Wilson [MVP Windows Installer]
    ----
    "techie" <> wrote in message
    news:...
    > I'm trying to use system.web.mail to send an email, but the smtp
    > server
    > requires authentication. I came across some info about fields
    > property
    >
    > Dim mail As New MailMessage()
    > mail.To = "
    > mail.From = ""
    > 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)
    >
    >
    > I get a compilation error:
    >
    > 'Fields' is not a member of 'System.Web.Mail.MailMessage'
    >
    > Even though I have installed .Net Framework 1.1, i am not able to
    > compile the code. Can anybody help me on this.
    > Thanks in advance.
    > Techie
     
    Phil Wilson, May 12, 2004
    #2
    1. Advertising

  3. techie

    techie Guest

    How can i make VS use the 1.1 framework? how can i remove the compilation error.
    I simply cannot go ahead.


    "Phil Wilson" <> wrote in message news:<#>...
    > If you are using VS.NET, that might be the problem. It's using the 1.0
    > framework.
    > --
    > Phil Wilson [MVP Windows Installer]
    > ----
    > "techie" <> wrote in message
    > news:...
    > > I'm trying to use system.web.mail to send an email, but the smtp
    > > server
    > > requires authentication. I came across some info about fields
    > > property
    > >
    > > Dim mail As New MailMessage()
    > > mail.To = "
    > > mail.From = ""
    > > 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)
    > >
    > >
    > > I get a compilation error:
    > >
    > > 'Fields' is not a member of 'System.Web.Mail.MailMessage'
    > >
    > > Even though I have installed .Net Framework 1.1, i am not able to
    > > compile the code. Can anybody help me on this.
    > > Thanks in advance.
    > > Techie
     
    techie, May 12, 2004
    #3
  4. techie

    Phil Wilson Guest

    VSNET uses the 1.0 framework at development time. VS 2003 uses the 1.1
    framework - you can't change this. If you must use fields, you must use VS
    2003 so you can develop against the 1.1 framework.
    --
    Phil Wilson [MVP Windows Installer]
    ----
    "techie" <> wrote in message
    news:...
    > How can i make VS use the 1.1 framework? how can i remove the compilation

    error.
    > I simply cannot go ahead.
    >
    >
    > "Phil Wilson" <> wrote in message

    news:<#>...
    > > If you are using VS.NET, that might be the problem. It's using the 1.0
    > > framework.
    > > --
    > > Phil Wilson [MVP Windows Installer]
    > > ----
    > > "techie" <> wrote in message
    > > news:...
    > > > I'm trying to use system.web.mail to send an email, but the smtp
    > > > server
    > > > requires authentication. I came across some info about fields
    > > > property
    > > >
    > > > Dim mail As New MailMessage()
    > > > mail.To = "
    > > > mail.From = ""
    > > > 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)
    > > >
    > > >
    > > > I get a compilation error:
    > > >
    > > > 'Fields' is not a member of 'System.Web.Mail.MailMessage'
    > > >
    > > > Even though I have installed .Net Framework 1.1, i am not able to
    > > > compile the code. Can anybody help me on this.
    > > > Thanks in advance.
    > > > Techie
     
    Phil Wilson, May 12, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bertus Dam
    Replies:
    5
    Views:
    867
    Bertus Dam
    Aug 29, 2003
  2. stuart
    Replies:
    1
    Views:
    2,579
    Jacky Kwok
    Nov 10, 2003
  3. martin
    Replies:
    5
    Views:
    2,115
    Hans Kesting
    Dec 19, 2003
  4. gh0st54
    Replies:
    0
    Views:
    357
    gh0st54
    Oct 26, 2004
  5. =?Utf-8?B?TWlja2VCb3k=?=

    Problem with System.Web.Mail.MailMessage and HTML mail

    =?Utf-8?B?TWlja2VCb3k=?=, Jun 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    916
    =?Utf-8?B?TWlja2VCb3k=?=
    Jun 21, 2005
Loading...

Share This Page