Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » System.Web.Mail   (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

Example of setting headers with System.Web.Mail

//============================ Optional Settings ======================== if (this.Priority.Length != 0) { if (this.Priority == "Non Urgent") { oMsg.Priority = System.Web.Mail.MailPriority.Low; }; if (this.Priority == "Normal") { oMsg.Priority = System.Web.Mail.MailPriority.Normal;

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

SmtpMail.SmtpServer.Insert(0, "mail.mycompany.com") causes 0x80040220 to be thrown.

Email was being sent using SmtpMail from System.Web.Mail. The code worked on the older 2000 server, however did not work when placed on the new 2003 server. When the email was sent, the code threw the following error: (0x80040220) The 'SendUsing' configuration

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
 
Page view tracker