Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

i have hmail server installed for intranet mailing in my office. i have been using Windows live and outlook express for acessing emails on client machines. i am planning to build a reporting application in c# winforms in which certain reports has to be created and it should be sent through email for all the users. reports should be generated and sent by any of the client systems. for mailni purpose i ahve done the following.

C#
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient("192.168.0.113",25);

message.From = new MailAddress("abc@123.com");
message.To.Add(new MailAddress("def@123.com"));
message.Subject = "Test";
message.Body = "Content";
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("abc@123.com", "123456");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);

domain name has been changed.192.168.0.113 is smtp host.same seetings are given in outlook express and windows live.user credentials are correct but application is throwing the follwing SMTP exception.
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: Failure sending mail.

can anyone help me out to resolve this issue..??
thank you
Posted
Updated 11-Aug-15 21:58pm
v2

1 solution

Check your credentials and your port number: since you are using SSL, it's possible that you need a different port number, or that the port is blocked by firewall on one PC or another.

If that all looks right, try again without SSL and see if that makes any difference.
At the moment, you need to get information - so look at any inner exception as well - and we can't get that for you: we don't have access to your mail server!
 
Share this answer
 
Comments
vikaskallidantheyil 13-Aug-15 0:32am    
i tried without SSL but of no use. Same Errors throws now also. what acutualy you meant by inner exception.??
vikaskallidantheyil 13-Aug-15 3:15am    
InnerException: System.Net.Sockets.SocketException
HResult=-2147467259
Message=No connection could be made because the target machine actively refused it 192.168.0.113:25
Source=System
ErrorCode=10061
NativeErrorCode=10061
StackTrace:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
InnerException:
vikaskallidantheyil 13-Aug-15 3:16am    
this is what i got.. any idea about this. it says machine actively refused. why it could be?? please sugest..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900