Link to home
Start Free TrialLog in
Avatar of tjrobinson
tjrobinson

asked on

CDO 1.2.1 - Send Method (Message Object) problem, doesn't take parameters

I've referenced the Microsoft CDO 1.2.1 Library (COM) using C# and Visual Studio .NET 2003.

This part compiles:

CDO.Message myMail = new CDO.Message();
myMail.Subject="Sending email with CDO";
myMail.From="mymail@mydomain.com";
myMail.To="mymail@mydomain.com";

But this bit doesn't:

myMail.Send(true, true, 0);

Unless I change it to:

myMail.Send(); // i.e. no parameters

The MSDN documentation says it can take 3 parameters:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_send_method_message.asp

The error is:

No overload for method 'Send' takes '3' arguments

What's going on?

Avatar of msdixon
msdixon

there's a class in the .net framework for this. its usage is below:

         System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
         msg.Subject = "Sending email with CDO";
         msg.From = "mymail@mydomain.com";
         msg.To = "mymail@mydomain.com";
         msg.Body = "This is a test";
         System.Web.Mail.SmtpMail.SmtpServer = "mail.domain.com";
         System.Web.Mail.SmtpMail.Send(msg);
ASKER CERTIFIED SOLUTION
Avatar of Chester_M_Ragel
Chester_M_Ragel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjrobinson

ASKER

Thanks. The reason I specifically want to use parameters is that I want to popup the mail composition window of the default mail client, in most cases Outlook 2000, with the subject, message and attachment already added. This is so the user can choose the recipient.

The System.Web.Mail class doesn't allow this and if Chester_M_Ragel is right, then it's not possible with CDO either.

I'll give Outlook Redemption a try:

http://www.dimastr.com/redemption/

Any maybe MAPI33 (doesn't look as professional though):

http://www.dimastr.com/redemption/

Any further ideas?
MAPI33(www.mapi33.freeservers.com) may be a good one. But it was not that easy to use. Here are some sample on that( g8.cx/mapi/ ). As I said it is very easy to if you go for redumption.