Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » CDOSYS   (RSS)

Enumerating fields for CDOSYS, System.Web.Mail and System.Net.Mail

There are times when you may want to enumerate the fields set on a message while debugging issues with CDOSYS, System.Web.Mail, or System.Net.Mail. Below is sample code which will enumerate these fields. As you can see, there are some considerable differenences

Adding Inline Attachments with CDOSYS and System.Net.Mail.

In the following samples, I'm going to send an inline attachment using CDOSYS and System.Net.Mail (SNM). Lets say you have an html document with text above and below a jpg file and you want this document inside of a message you are going to send. Below

HOWTO: Set and Get the a multibyte (Japanese, Chinese, Etc) custom header with CDOSYS

Custom headers in multibyte languages (Japanese, Chinese, etc) will not be encoded properly when set using CDO alone. They may appear to be correctly set, however when read back on a recieved message they may be messed-up. Here is an example of a Japanese

Howto: Add a body part to a message using CDOSYS.

The sample below shows how to add an additional body part to a message using cdosys. This example demonstrates adding a "text/calendar" (vcalendar) body part, however it should be possible to use this to add "text/plain", "text/html" and other types.

Example of setting headers with CDOSYS

//============================ Optional Settings ======================== if (this.Priority.Length != 0) { // Well... it seems that priority is not what needs to be set to get priority set... // Looks like setting importance will set priority... at least

System.Net.Mail with SSL to authenticate against port 465

Sending mail using System.Net.Mail with SSL will fail: System.Net. NetworkCredential aCred = new System.Net. NetworkCredential ( "myacct" , "mypassword" ); SmtpClient smtp = new SmtpClient ( "smtp.mail.myserver.com" , 465); smtp.EnableSsl = true ; smtp.UseDefaultCredentials

CDOSYS breaks after removing Outlook Express.

Yep, that will do it. There is a relationship between CDOSYS and Outlook Express. So, you should not remove Outlook Express if you ever expect to use CDOSYS or have anything which uses CDOSYS work properly. Some people get very ambitious about security

Howto: CDOSYS/C# Sending an ICS file

Todo: 1) Open an appointment in Outlook. Save to file as an .ICS file. 2) Create a C# project and add the code below. 3) Do the TODO sections. 'TODO: Add a refernce to CDOSYS using System.IO; private void btnSendUsingIcs_Click(object sender, System.EventArgs

Building VCALENDAR content without an Microsoft API is not supported by MS.

While Microsoft products follow many RFC guidelines for VCALENDAR/iCAL, it does not mean that they support development of VCALENDAR/iCAL directly. Microsoft has APIs which can build and read such content. Working with those APIs is supported; however

HOWTO: Attatch .ics, .mht files with CDOSYS/System.Web.Mail

Note: By setting the ContentMediaType property of the attatchment body part object to "text/html", you should be able to properly attatch most any type of file. This includes .mht, .ics, etc. Example: // Attatch needed files. // TODO: Change this section

Why is CDOSYS failing in a stored proceedure?

If you’re experiencing issues with CDOSYS under a stored procedure, you may be running into one of the issues I'll mention here. Outlook is usually installed on SQL Servers in order to provide mail sending capability (using xp_sendmail). However, xp_sendmail
 
Page view tracker