smtp server need authentication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • motis

    #1

    smtp server need authentication

    Hi all

    I try to send email by smtp server.
    But, my smtp server need authentication !
    How can I do it?
    with thanks

    Motis

  • mwolf

    #2
    Re: smtp server need authentication

    as far as I know the built in .net object does not support this, you
    need a third party tool

    Comment

    • Vadym Stetsyak

      #3
      Re: smtp server need authentication

      Hello, motis!

      how do you send your email? using networking or SmtpClient?
      If you use SmtpClient look at Credentials property.

      here is sample code

      string to = "jane@contoso.c om";
      string from = "ben@contoso.co m";
      string subject = "Using the new SMTP client.";
      string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
      MailMessage message = new MailMessage(fro m, to, subject, body);
      SmtpClient client = new SmtpClient(serv er, port);
      // Credentials are necessary if the server requires the client
      // to authenticate before it will send e-mail on the client's behalf.
      client.Credenti als = CredentialCache .DefaultNetwork Credentials;

      client.Send(mes sage);
      --
      Regards, Vadym Stetsyak
      www: http://vadmyst.blogspot.com

      Comment

      • motis

        #4
        Re: smtp server need authentication

        Hi Vadym

        I need a user name and password...
        like

        client.Credenti als = XXXXX.user name
        client.Credenti als = XXXXX.password

        Can you help...?

        Moti

        "Vadym Stetsyak" wrote:
        [color=blue]
        > Hello, motis!
        >
        > how do you send your email? using networking or SmtpClient?
        > If you use SmtpClient look at Credentials property.
        >
        > here is sample code
        >
        > string to = "jane@contoso.c om";
        > string from = "ben@contoso.co m";
        > string subject = "Using the new SMTP client.";
        > string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
        > MailMessage message = new MailMessage(fro m, to, subject, body);
        > SmtpClient client = new SmtpClient(serv er, port);
        > // Credentials are necessary if the server requires the client
        > // to authenticate before it will send e-mail on the client's behalf.
        > client.Credenti als = CredentialCache .DefaultNetwork Credentials;
        >
        > client.Send(mes sage);
        > --
        > Regards, Vadym Stetsyak
        > www: http://vadmyst.blogspot[/color]

        Comment

        • motis

          #5
          Re: smtp server need authentication

          Hi all

          I need to do:

          client.Credenti als = new System.Net.Netw orkCredential(" user", "password") ;

          with thanks to you all

          Moti

          "motis" wrote:
          [color=blue]
          > Hi Vadym
          >
          > I need a user name and password...
          > like
          >
          > client.Credenti als = XXXXX.user name
          > client.Credenti als = XXXXX.password
          >
          > Can you help...?
          >
          > Moti
          >
          > "Vadym Stetsyak" wrote:
          >[color=green]
          > > Hello, motis!
          > >
          > > how do you send your email? using networking or SmtpClient?
          > > If you use SmtpClient look at Credentials property.
          > >
          > > here is sample code
          > >
          > > string to = "jane@contoso.c om";
          > > string from = "ben@contoso.co m";
          > > string subject = "Using the new SMTP client.";
          > > string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
          > > MailMessage message = new MailMessage(fro m, to, subject, body);
          > > SmtpClient client = new SmtpClient(serv er, port);
          > > // Credentials are necessary if the server requires the client
          > > // to authenticate before it will send e-mail on the client's behalf.
          > > client.Credenti als = CredentialCache .DefaultNetwork Credentials;
          > >
          > > client.Send(mes sage);
          > > --
          > > Regards, Vadym Stetsyak
          > > www: http://vadmyst.blogspot[/color][/color]

          Comment

          Working...