开发者

Problem with Interop.CDO

I have created an application (compiled any cpu) that use a lib also compiled as any cpu (the library reference interop.CDO), and i have this error message:

Could not load file or assembly 'Interop.CDO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its d开发者_如何学Pythonependencies.Attempt was made to load the program with an incorrect format.

The problem is related with 64/32 compatibility. any solution for this problem ?

Thanks for help.


I think that CDO was deprecated in the previous century. There certainly will never be a 64-bit version of it. There's little point, .NET has good SMTP support.

Use Project + Properties, Build tab, Platform target = x86 on your EXE project if you have to. If this is ASP then you'll have to run your web app in a 32-bit application pool.


I don't know what is your problem but I would suggest you not to use the COM component anymore. Can't you use System.Net.Mail ?

Some code might help:

MailMessage message = new MailMessage();

message.From = new MailAddress("sender@foo.bar.com");

message.To.Add(new MailAddress("recipient1@foo.bar.com"));
message.To.Add(new MailAddress("recipient2@foo.bar.com"));

message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));

message.Subject = "This is my subject";
message.Body = "This is the content";

SmtpClient client = new SmtpClient();

client.Send(message);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜