Hi
I try to write a console application in c# whichs sends a mail using CDO 1.21 (I can't use a smtp server).
I found a good description for j++ (http://support.microsoft.com/kb/216723/en-us), but don't know how to write the cdo parts in c#. I could logon to my profile, but I wasn't able to create or send a message.
I would be very happy for a code example which shows how to send a mail using CDO in C# (just a simple console application would be great).
Thanks for any help.
Ralph

How To Send a Mail Using CDO 1.21 with C#
hhhguten
The program is running on an Exchange 2003 Server. It is not supported to install outlook on it. So the only way to create the MAPI Profile is to use a tool called profgen2 (it's a tool to create MAPI Profile without installing Outlook). This tool works fine, but I think it won't be possible to use Simple MAPI without an installation of outlook. I think by installing outlook, a new mapi32.dll (and will overwrite the original Exchange 2003 mapi32.dll) will be installed and then Simple MAPI would be supported. But the system might become instable. Therefore I can't do that.
So I guess I have to use (Extended)MAPI or CDO.
But I can't find anywhere in the web an example in C#...maybe it's not possible
stuartdunkeld
The current version is still for .NET 1.1 but there haven't been any significant changes to this functionality for 2.0. You'll want to extract the relevant classes and use them separately since a lot of the library is taken up by strongly-typed collections which are rather useless given .NET 2.0 generics.
raymuirhead
Hi Chris
Thanks a lot for your help. Very interesting projects, I have to say !
Unfortunately your library worked only with the mapi32.dll on my win2k machine.
After I deployed on a server 2003 machine (different version of mapi32.dll), I caught an exception (unable to find an entry point named MapiSendMail in DLL mapi32.dll).
After I changed the dll on the 2003 machine with the one from win2k, I could run the program, but it was now looking for a Outlook Express Profile (the MAPI profiles weren't visible anymore). Even with profgen2 (a tool to create MAPI profile without installing outlook) I couldn't listen or create any MAPI profiles.
After I changed the dll back, the MAPI profiles were again available.
I guess I have to look for a solution in CDO or whatever. I'm open for any solution, which will work.
The main goals for the solution are:
- Sending emails from a c# console application
- using stored MAPI Profiles (Logon to a MAPI Session (without dialog))
- Running on Server 2003
Thanks for any help !
Regards
Ralph
John Sudds - MSFT
Never mind...
Thanks a lot !
sved
If you only need to send mails then the .NET way of doing it is to use System.Web.Mail in v1.1.
Here is a good example:
http://www.codersource.net/csharp_sending_emails.aspx
In .NET v2.0, there is a new System.Net.Mail namespace and it is recommended that you use that:
http://msdn2.microsoft.com/library/dk1fb84h(en-us,vs.80).aspx
Tutorial:
http://www.eggheadcafe.com/articles/20050505.asp
Regards,
Vikram
OrfWare
Hi Vikram
Thanks a lot for your answer. Unfortunately it this doesn't help me much.
I need to send mails using a Mapi profile. To send mails using a Mapi profile, you have to implement CDO or SimpleMapi (as far as I know), but I don't know how to implement it. I've been a lot of searching on the web, but I havent't found an example how to do this in C# (I found an example as I mentioned in J++ and as well one written in Perl).
But I still hope this is possible in C#.
Anyway, thanks a lot for your help !
Regards
Ralph
Hyro
Here's a note from the Simple MAPI documentation on MSDN indicating that Exchange Server 2003 is not sufficient:
"Simple MAPI is not installed by Exchange Server 2003 or later. However, Simple MAPI is supported for use with Exchange 2003. To function properly, the underlying Exchange or Microsoft OutlookR MAPI subsystem must be properly installed on the client computer."
AdkMan
CDO is object-oriented, though. I think you'd need a COM import wrapper for that one.
Certainly doable but I'm not aware of any existing implementations... sorry.