Help, Can't send to SMTP using SmtpClient using SSL on port 465

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

    Help, Can't send to SMTP using SmtpClient using SSL on port 465



    The following code is giving me a timeout problem., no matter what I do I
    can't send a piece of mail using .net2.0 System.Net.Mail .SmtpClient via port
    465 and using ssl, if however I try using outlook or outlook express it
    works fine..



    System.Net.Mail .MailMessage msgMail = new
    System.Net.Mail .MailMessage("m yemail@mydomain .com",
    "testemail@mydo main.com", "subject", "message body");

    SmtpClient smtp = new SmtpClient("smt p.postoffice.ne t", 465);

    smtp.EnableSsl = true;

    smtp.UseDefault Credentials = false;

    smtp.DeliveryMe thod = SmtpDeliveryMet hod.Network;

    smtp.Credential s = new System.Net.Netw orkCredential(m yemail@mydomain .com,
    "mypassword ");

    try

    {

    // the following line is where it times out

    smtp.Send(msgMa il);

    }

    catch (Exception ex)

    {

    }



    I also did a trace log and this is what it looks like...



    System.Net Information: 0 : [5260] Associating MailMessage#610 58004 with
    Message#6325563 7
    System.Net Verbose: 0 : [5260] SmtpClient::.ct or(host=smtp.po stoffice.net,
    port=465)
    System.Net Information: 0 : [5260] Associating SmtpClient#2793 1403 with
    SmtpTransport#4 8953616
    System.Net Verbose: 0 : [5260] Exiting SmtpClient::.ct or() ->
    SmtpClient#2793 1403
    System.Net Verbose: 0 : [5260]
    SmtpClient#2793 1403::Send(Mail Message#6105800 4)
    System.Net Information: 0 : [5260]
    SmtpClient#2793 1403::Send(Deli veryMethod=Netw ork)
    System.Net Information: 0 : [5260] Associating SmtpClient#2793 1403 with
    MailMessage#610 58004
    System.Net Information: 0 : [5260] Associating SmtpTransport#4 8953616 with
    SmtpConnection# 55429074
    System.Net Information: 0 : [5260] Associating SmtpConnection# 55429074 with
    ServicePoint#11 280399
    System.Net Information: 0 : [5260] Associating SmtpConnection# 55429074 with
    SmtpPooledStrea m#37855919
    System.Net Error: 0 : [5260] Exception in the SmtpClient#2793 1403::Send -
    Unable to read data from the transport connection: A blocking operation was
    interrupted by a call to WSACancelBlocki ngCall.
    System.Net Error: 0 : [5260] at
    System.Net.Sock ets.NetworkStre am.Read(Byte[] buffer, Int32 offset, Int32
    size)
    at System.Net.Dele gatedStream.Rea d(Byte[] buffer, Int32 offset, Int32
    count)
    at System.Net.Buff eredReadStream. Read(Byte[] buffer, Int32 offset, Int32
    count)
    at System.Net.Mail .SmtpReplyReade rFactory.ReadLi nes(SmtpReplyRe ader
    caller, Boolean oneLine)
    at System.Net.Mail .SmtpReplyReade rFactory.ReadLi ne(SmtpReplyRea der
    caller)
    at System.Net.Mail .SmtpReplyReade r.ReadLine()
    at System.Net.Mail .SmtpConnection .GetConnection( String host, Int32 port)
    at System.Net.Mail .SmtpTransport. GetConnection(S tring host, Int32 port)
    at System.Net.Mail .SmtpClient.Get Connection()
    at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
    System.Net Verbose: 0 : [5260] Exiting SmtpClient#2793 1403::Send()






  • Rob Dob

    #2
    Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

    Thanks, but this is just test code, when I trace it through the debugger I
    get a timout exception thrown.. do you have any idea as to why I cannot get
    SmtpClient working with SSL and 465?

    Thanks,


    Comment

    • Eugene Mayevski

      #3
      Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

      Hello!
      You wrote on Fri, 11 Jan 2008 08:44:48 -0500:

      RDThanks, but this is just test code, when I trace it through the
      RDdebugger I get a timout exception thrown.. do you have any idea as to
      RDwhy I cannot get SmtpClient working with SSL and 465?

      Does your server use implicit or explicit SSL/TLS? I don't know which one
      SmtpClient class support but it looks like it supports not the one that your
      server uses.

      Our SMTP client component supports both imlicit and explicit TLS. See http://www.eldos.com/sbb/desc-ssl-features.php


      With best regards,
      Eugene Mayevski
      http://www.SecureBlackbox.com - the comprehensive component suite for
      network security

      Comment

      • Rob Dob

        #4
        Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

        Does your server use implicit or explicit SSL/TLS? I don't know which one
        SmtpClient class support but it looks like it supports not the one that
        your server uses.
        >
        I'm trying to connect with the usa.net mail server, which is
        smtp.postoffice .net I would assume it support both, aswell I have tried
        this with both tls on and tls off using my own mail server.. no cigar.. Do
        you see anything wrong with my code?

        thanks,


        Comment

        • sloan

          #5
          Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

          Try 587.

          Download the code from here:
          http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!138.entry

          and see if you can tweak the settings to work with your setup.



          "Rob Dob" <robdob20012002 @yahoo.comwrote in message
          news:uKVVZHAVIH A.1480@TK2MSFTN GP06.phx.gbl...
          >
          >
          The following code is giving me a timeout problem., no matter what I do I
          can't send a piece of mail using .net2.0 System.Net.Mail .SmtpClient via
          port 465 and using ssl, if however I try using outlook or outlook express
          it works fine..
          >
          >
          >
          System.Net.Mail .MailMessage msgMail = new
          System.Net.Mail .MailMessage("m yemail@mydomain .com",
          "testemail@mydo main.com", "subject", "message body");
          >
          SmtpClient smtp = new SmtpClient("smt p.postoffice.ne t", 465);
          >
          smtp.EnableSsl = true;
          >
          smtp.UseDefault Credentials = false;
          >
          smtp.DeliveryMe thod = SmtpDeliveryMet hod.Network;
          >
          smtp.Credential s = new System.Net.Netw orkCredential(m yemail@mydomain .com,
          "mypassword ");
          >
          try
          >
          {
          >
          // the following line is where it times out
          >
          smtp.Send(msgMa il);
          >
          }
          >
          catch (Exception ex)
          >
          {
          >
          }
          >
          >
          >
          I also did a trace log and this is what it looks like...
          >
          >
          >
          System.Net Information: 0 : [5260] Associating MailMessage#610 58004 with
          Message#6325563 7
          System.Net Verbose: 0 : [5260] SmtpClient::.ct or(host=smtp.po stoffice.net,
          port=465)
          System.Net Information: 0 : [5260] Associating SmtpClient#2793 1403 with
          SmtpTransport#4 8953616
          System.Net Verbose: 0 : [5260] Exiting SmtpClient::.ct or() ->
          SmtpClient#2793 1403
          System.Net Verbose: 0 : [5260]
          SmtpClient#2793 1403::Send(Mail Message#6105800 4)
          System.Net Information: 0 : [5260]
          SmtpClient#2793 1403::Send(Deli veryMethod=Netw ork)
          System.Net Information: 0 : [5260] Associating SmtpClient#2793 1403 with
          MailMessage#610 58004
          System.Net Information: 0 : [5260] Associating SmtpTransport#4 8953616 with
          SmtpConnection# 55429074
          System.Net Information: 0 : [5260] Associating SmtpConnection# 55429074
          with ServicePoint#11 280399
          System.Net Information: 0 : [5260] Associating SmtpConnection# 55429074
          with SmtpPooledStrea m#37855919
          System.Net Error: 0 : [5260] Exception in the SmtpClient#2793 1403::Send -
          Unable to read data from the transport connection: A blocking operation
          was interrupted by a call to WSACancelBlocki ngCall.
          System.Net Error: 0 : [5260] at
          System.Net.Sock ets.NetworkStre am.Read(Byte[] buffer, Int32 offset, Int32
          size)
          at System.Net.Dele gatedStream.Rea d(Byte[] buffer, Int32 offset, Int32
          count)
          at System.Net.Buff eredReadStream. Read(Byte[] buffer, Int32 offset, Int32
          count)
          at System.Net.Mail .SmtpReplyReade rFactory.ReadLi nes(SmtpReplyRe ader
          caller, Boolean oneLine)
          at System.Net.Mail .SmtpReplyReade rFactory.ReadLi ne(SmtpReplyRea der
          caller)
          at System.Net.Mail .SmtpReplyReade r.ReadLine()
          at System.Net.Mail .SmtpConnection .GetConnection( String host, Int32 port)
          at System.Net.Mail .SmtpTransport. GetConnection(S tring host, Int32 port)
          at System.Net.Mail .SmtpClient.Get Connection()
          at System.Net.Mail .SmtpClient.Sen d(MailMessage message)
          System.Net Verbose: 0 : [5260] Exiting SmtpClient#2793 1403::Send()
          >
          >
          >
          >
          >
          >

          Comment

          • Rob Dob

            #6
            Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

            Try 587.
            >
            Download the code from here:
            http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!138.entry
            >
            Hi,

            telnet smtp.postoffice .net 587 does not connect, it appears that this smtp
            server only accepts connections on port 465. Also this application is a C#
            winform application..

            does you have any other suggestions, this is really frustrating..

            thanks,


            Comment

            • Eugene Mayevski

              #7
              Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

              Hello!
              You wrote on Fri, 11 Jan 2008 09:27:19 -0500:

              RDI'm trying to connect with the usa.net mail server, which is
              RDsmtp.postoffi ce.net I would assume it support both, aswell I have
              RDtried this with both tls on and tls off using my own mail server.. no
              RDcigar.. Do you see anything wrong with my code?

              All I can tell you is that usa.net SMTP uses implicit TLS on port 465 and
              explicit TLS on port 25 (pretty standard way).
              I've checked our client in both modes and it worked fine. I can say nothing
              about .NET class.

              With best regards,
              Eugene Mayevski
              http://www.SecureBlackbox.com - the comprehensive component suite for
              network security

              Comment

              • Rob Dob

                #8
                Re: Help, Can't send to SMTP using SmtpClient using SSL on port 465

                What is the best foru to post in to get an answer for this question, I'm
                sure there must be some sort of answer?

                thanks,


                Comment

                Working...