Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Dob - 11 Jan 2008 03:27 GMT
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("myemail@mydomain.com",
"testemail@mydomain.com", "subject", "message body");

SmtpClient smtp = new SmtpClient("smtp.postoffice.net", 465);

smtp.EnableSsl = true;

smtp.UseDefaultCredentials = false;

smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

smtp.Credentials = new System.Net.NetworkCredential(myemail@mydomain.com,
"mypassword");

try

{

// the following line is where it times out

smtp.Send(msgMail);

}

catch (Exception ex)

{

}

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

System.Net Information: 0 : [5260] Associating MailMessage#61058004 with
Message#63255637
System.Net Verbose: 0 : [5260] SmtpClient::.ctor(host=smtp.postoffice.net,
port=465)
System.Net Information: 0 : [5260] Associating SmtpClient#27931403 with
SmtpTransport#48953616
System.Net Verbose: 0 : [5260] Exiting SmtpClient::.ctor()  ->
SmtpClient#27931403
System.Net Verbose: 0 : [5260]
SmtpClient#27931403::Send(MailMessage#61058004)
System.Net Information: 0 : [5260]
SmtpClient#27931403::Send(DeliveryMethod=Network)
System.Net Information: 0 : [5260] Associating SmtpClient#27931403 with
MailMessage#61058004
System.Net Information: 0 : [5260] Associating SmtpTransport#48953616 with
SmtpConnection#55429074
System.Net Information: 0 : [5260] Associating SmtpConnection#55429074 with
ServicePoint#11280399
System.Net Information: 0 : [5260] Associating SmtpConnection#55429074 with
SmtpPooledStream#37855919
System.Net Error: 0 : [5260] Exception in the SmtpClient#27931403::Send -
Unable to read data from the transport connection: A blocking operation was
interrupted by a call to WSACancelBlockingCall.
System.Net Error: 0 : [5260]    at
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32
size)
  at System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32
count)
  at System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32
count)
  at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader
caller, Boolean oneLine)
  at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader
caller)
  at System.Net.Mail.SmtpReplyReader.ReadLine()
  at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
  at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
  at System.Net.Mail.SmtpClient.GetConnection()
  at System.Net.Mail.SmtpClient.Send(MailMessage message)
System.Net Verbose: 0 : [5260] Exiting SmtpClient#27931403::Send()
christery@gmail.com - 11 Jan 2008 10:44 GMT
> catch (Exception ex)
>
> {
>
> }

Thats catchy... try using that to gather info from smtp enabled
things, thus http://technet.microsoft.com/en-us/library/system.net.mail.smtpexception.aspx
maybe go sending async if that helps... I dont know...

But that catch is just what I wanna do
catch(Expression E){ /handle it or write out something/} finally{/cry
wolf anyway, the recipient is having the same problem/}

//CY
Rob Dob - 11 Jan 2008 13:44 GMT
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,
Eugene Mayevski - 11 Jan 2008 14:08 GMT
Hello!
You wrote  on Fri, 11 Jan 2008 08:44:48 -0500:

RD> Thanks, but this is just test code,  when I trace it through the
RD> debugger I get a timout exception thrown.. do you have any idea as to
RD> why 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
Rob Dob - 11 Jan 2008 14:27 GMT
> 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,
Eugene Mayevski - 11 Jan 2008 15:01 GMT
Hello!
You wrote  on Fri, 11 Jan 2008 09:27:19 -0500:

RD> I'm trying to connect with the usa.net mail server,  which is
RD> smtp.postoffice.net  I would assume it support both,  aswell I have
RD> tried this with both tls on and tls off using my own mail server..  no
RD> cigar..  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
sloan - 11 Jan 2008 14:31 GMT
Try 587.

Download the code from here:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

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

> 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
[quoted text clipped - 74 lines]
>   at System.Net.Mail.SmtpClient.Send(MailMessage message)
> System.Net Verbose: 0 : [5260] Exiting SmtpClient#27931403::Send()
Rob Dob - 11 Jan 2008 14:49 GMT
> Try 587.
>
> Download the code from here:
> http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!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,
Rob Dob - 11 Jan 2008 17:21 GMT
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,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.