send mail with remote smtp

Discussion in 'ASP .Net' started by ratnesh, Jul 9, 2004.

  1. ratnesh

    ratnesh Guest

    hi,

    how can i send smtp mail from my asp.net webform.
    i give the smtp server name,
    but the server is remote and it requires authentication (login) to send
    mail.
    i dont know how to do that

    thanks
     
    ratnesh, Jul 9, 2004
    #1
    1. Advertising

  2. ratnesh

    Jos Guest

    ratnesh wrote:
    > hi,
    >
    > how can i send smtp mail from my asp.net webform.
    > i give the smtp server name,
    > but the server is remote and it requires authentication (login) to
    > send mail.
    > i dont know how to do that


    Try something like this:

    Dim oMail As MailMessage = New MailMessage()
    oMail.To =
    oMail.From =
    oMail.Subject = "Important message"
    oMail.Body = "Your message here."
    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverp
    ort",25)
    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
    2)
    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthent
    icate",2)
    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusernam
    e","yourusername")
    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpasswor
    d","yoursecretpassword")
    SmtpMail.SmtpServer = "smtp.yourserver.com"
    SmtpMail.Send(oMail)

    --

    Jos
     
    Jos, Jul 9, 2004
    #2
    1. Advertising

  3. ratnesh

    ratnesh Guest

    please help me
    WebForm1.aspx.vb(45): 'Fields' is not a member of
    'System.Web.Mail.MailMessage'.
    this error is showing up.
    thanks



    "Jos" <> wrote in message
    news:#...
    > ratnesh wrote:
    > > hi,
    > >
    > > how can i send smtp mail from my asp.net webform.
    > > i give the smtp server name,
    > > but the server is remote and it requires authentication (login) to
    > > send mail.
    > > i dont know how to do that

    >
    > Try something like this:
    >
    > Dim oMail As MailMessage = New MailMessage()
    > oMail.To =
    > oMail.From =
    > oMail.Subject = "Important message"
    > oMail.Body = "Your message here."
    >

    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverp
    > ort",25)
    >

    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
    > 2)
    >

    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthent
    > icate",2)
    >

    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusernam
    > e","yourusername")
    >

    oMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpasswor
    > d","yoursecretpassword")
    > SmtpMail.SmtpServer = "smtp.yourserver.com"
    > SmtpMail.Send(oMail)
    >
    > --
    >
    > Jos
    >
    >
     
    ratnesh, Jul 9, 2004
    #3
  4. ratnesh

    Jos Guest

    ratnesh wrote:
    > please help me
    > WebForm1.aspx.vb(45): 'Fields' is not a member of
    > 'System.Web.Mail.MailMessage'.
    > this error is showing up.
    > thanks


    Fields only works in dotNET version 1.1.
    See
    http://www.dotnet247.com/247reference/msgs/49/248767.aspx
    for a similar problem.

    If you get this problem on your development server, you
    may install v1.1 (www.asp.net), even if you don't
    develop in Visual Studio 2003.

    --

    Jos
     
    Jos, Jul 10, 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. Ones Self
    Replies:
    1
    Views:
    740
    Karel Kubat
    Jul 1, 2004
  2. RN
    Replies:
    3
    Views:
    622
    Smithers
    Feb 23, 2005
  3. Replies:
    3
    Views:
    1,093
    Roedy Green
    Jan 24, 2006
  4. Alex Hunsley
    Replies:
    4
    Views:
    3,492
    Tim Williams (gmail)
    Jun 29, 2004
  5. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    888
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
Loading...

Share This Page