Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am trying to figure out what suddenly happened to my project. It was working fine but now its not.
this is stack trace

   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at WindowsKeyloggerTool.frmSettings.SendTestMail(String message) in c:\users\avinash\documents\visual studio 2010\Projects\WindowsKeyloggerTool\WindowsKeyloggerTool\frmSettings.cs:line 103
   at WindowsKeyloggerTool.frmSettings.ValidateUserCredentials() in c:\users\avinash\documents\visual studio 2010\Projects\WindowsKeyloggerTool\WindowsKeyloggerTool\frmSettings.cs:line 75
and inner exception
Unable to find an entry point named 'EnumerateSecurityPackagesW' in DLL 'security.dll'.
   at System.Net.UnsafeNclNativeMethods.SafeNetHandles_SECURITY.EnumerateSecurityPackagesW(Int32& pkgnum, SafeFreeContextBuffer_SECURITY& handle)
   at System.Net.SafeFreeContextBuffer.EnumeratePackages(SecurDll Dll, Int32& pkgnum, SafeFreeContextBuffer& pkgArray)
   at System.Net.SSPISecureChannelType.EnumerateSecurityPackages(Int32& pkgnum, SafeFreeContextBuffer& pkgArray)
   at System.Net.SSPIWrapper.EnumerateSecurityPackages(SSPIInterface SecModule)
   at 


Please help me.
Posted
Updated 13-May-11 20:23pm
v2
Comments
OriginalGriff 14-May-11 2:14am    
OK, so that's the stack trace: what was the error message?

1 solution

How about you try this.....

first check connection...
C#
public bool Checking_Internet_Connection()
      {
          try
          {

              System.Net.Sockets.TcpClient clnt = new System.Net.Sockets.TcpClient("www.google.com", 80);

              clnt.Close();

              return true;

          }


then send message to required email address....
C#
public void Send_Email(Email_Message_Details Email_msg_details)
      {
          try
          {
              MailMessage mail = new MailMessage();
              SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
              mail.From = new MailAddress("gmailaccount");
              mail.To.Add("email address you want to send");
              mail.Subject = Email_msg_details.SUBJECT;
              mail.Body = Email_msg_details.BODYMESSAGE;

              SmtpServer.Port = 587;
              SmtpServer.Credentials = new System.Net.NetworkCredential("gmailaccount", "password");
              SmtpServer.EnableSsl = true;
              SmtpServer.Send(mail);
          }
          catch
          {
              return;
          }
      }
 
Share this answer
 
v2
Comments
sunder.tinwar 14-May-11 2:23am    
thanks for reply. But my internet connection is working. I will surely check before sending mails.

I have already posted this question thrice. I was working on a keylogger project. It was working fine. I took a backup and made some modifications. But now its not working. Mails are just not going to any mail provider by any credentials. But if I copy same code and make a demo app it will work.
Kim Togo 14-May-11 2:52am    
Try do compare the code that works and the code that do not work.
Find the differences in the code :-)

http://www.codeproject.com/Tips/174585/Using-Gmail-Account-to-Send-Emails.aspx
sunder.tinwar 14-May-11 3:06am    
Both codes are same. Even if I copy code from main application and paste in a demo application it will work. But main application does not.

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