473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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("my*****@mydomain.com" ,
"te*******@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(my*****@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(S mtpReplyReader
caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader
caller)
at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.SmtpConnection.GetConnection(Strin g 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()


Jan 11 '08 #1
7 22825
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,
Jan 11 '08 #2
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

Jan 11 '08 #3
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,
Jan 11 '08 #4
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.

"Rob Dob" <ro************@yahoo.comwrote in message
news:uK**************@TK2MSFTNGP06.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("my*****@mydomain.com" ,
"te*******@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(my*****@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(S mtpReplyReader
caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader
caller)
at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.SmtpConnection.GetConnection(Strin g 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()


Jan 11 '08 #5
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,
Jan 11 '08 #6
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.postoffice.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

Jan 11 '08 #7
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,
Jan 11 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mark | r | last post by:
is there a way of sending emails directly from iis without using an external SMTP service? mark
1
by: chalk | last post by:
xp_sendmail has died on our SQL Server, I get error "xp_sendmail: failed with mail error 0x80004005" if I try using it. I believe that the reason that this has happened is because the SQL Server...
5
by: Michal | last post by:
Hi I need to connect to Exchange 5.5 from .Net Web Application and send email using user profile. I did it two years ago on ASP but now I have to migrate it to .Net. I can not find any...
0
by: Nanker | last post by:
I would like to integrate Reporting Services reports into an existing email messaging framework using .NET 1.1 (both to leverage the existing framework and since the error reporting by Reporting...
1
by: =?Utf-8?B?dHZpbg==?= | last post by:
Hi everyone, Please can someone help me, i want to be sure if i can send emails from hotmail(e-mail) using asp.net and vb.net code or should i pay for new email so i can use smtp? thanks for...
0
by: =?Utf-8?B?dHZpbg==?= | last post by:
Hi everyone, can someone help me please. can i use hotmail e-mail to send emails in asp.net(vb code)? or should i pay for new email, so i can use smtp? thanks for your help
0
by: kittupalle | last post by:
hi...friends i am trying to send a SMS through GPRS using python. is it possible! if it is possible plzzzzzzz solve my problem. thankig you kittu.........
2
by: btcoder | last post by:
Hi, my jsp page uses sun.net.smtp.SmtpClient to send email. It worked fine until the hosted location was moved to another server. Now it generates the sun.net.smtp.SmtpProtocolException and the...
2
by: bvc123 | last post by:
i have tried but i didnt succeded in it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.