Free Support Forum -

System.AccessViolationException: Attempted to read or write protected memory


Sending SMTP email fails with the following error:

Unhandled Exception: Aspose.Network.Mail.SmtpException: Failure sending mail. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

I'm using Aspose.Network version The error shows up both in windows 7 (x64) and Windows 2008 (x64).

I noticed in your forum that this error occured already in previous versions September 2009) and would be solved quickly. Did I missed something or is this not fixed yet.

This is a very serious issue for me because my customers can not run my product under their x64 OS.

Any help on this issue is highly appriciated.



Hi Ron,

Thanks for considering Aspose.

Could you please try the latest version of Aspose.Network 4.9 and test if you still get the exception on 64 bit operating systems? I used the following sample code to send email using Aspose.Network 4.9 and Windows 2008 Server x64 and email was sent successfully.

SmtpClient client = new SmtpClient(“”, 587, "", “pwd”);
client.EnableSsl = true;
client.SecurityMode = SmtpSslSecurityMode.Explicit;

MailMessage msg = new MailMessage("", "");
msg.Subject = “Email Send Test”;
msg.Body = “This is a test”;



It works both on x86 and x64.

This ticket can be closed.

Thanks for your quick response,