• Wiz/dumb

    Form Region Leak in Visual Studio Tools for Office 2008 (v3) Template

    • 5 Comments

    I had a case on this a few months ago, but thought more folks might run into this as they start moving to form regions. By default, if you use the VSTO template for creating a form region in Outlook, the item is leaked. This can show up in a number of different symptoms, but the one we saw was that when the item was created (then saved and closed), then modified in WebDav, then they tried to modify the item again in Outlook, the user would get the error:

    "The item cannot be saved because it was changed by another user or in a another window."

    Fortunately, the resolution is easy, you just need to add a call to Marshal.ReleaseComObject to the FormRegionInitializing event in the designer code.

    private void FormRegion1Factory_FormRegionInitializing(object sender, Microsoft.Office.Tools.Outlook.FormRegionInitializingEventArgs e)
    {
        Marshal.ReleaseComObject(e.OutlookItem);
    }
  • Wiz/dumb

    Can’t Get Raw MIME in Transport Event in Exchange 2007 SP1

    • 2 Comments

    If you wrote a Transport Agent for Exchange 2007 RTM which was accessing the raw MIME message which doesn’t seem to work after installing SP1, there’s a good reason for that. In SP1, we moved content conversion to after the OnRoutedMessage event. This leaves you in the predicament of not having access to raw MIME content in any Transport Agent even for messages bound for external recipients. The change was by design to enhance some pipeline tracing features.

    While you don’t have access to raw MIME anymore, you can use the TnefReader class and the MailItem object you’re given to access message data and do your business logic there.

    Your other option is to set up a Send Connector to route outbound mail through an SMTP server and create an OnArrival SMTP sink. You should be able to get raw MIME there.

  • Wiz/dumb

    Why Pickups are the Best. More Robust, More Reliable, etc.

    • 1 Comments

    We get calls about this all the time. You have a CDOSYS application that…what? No, I’m not talking about automobiles, why did you…oh, the title. Well, it’s true. Read on.

    The Dreaded Transport Error

    The problem we see more than any other is when a customer is trying to send a lot of e-mail using an SMTP API such as CDOEX, CDOSYS, or System.Web.Mail, they will start to get CDO_E_FAILED_TO_CONNECT errors (0x80040213) (-2147220973) which is “The transport could not connect to the server.”

    The Resolution

    We see it over and over again. This error is because you are sending such a high volume of email over one port, typically the default port (25), that you flood the port with traffic until your app can no longer talk to the server. If your application is sending such a large volume of mail so quickly that it generates this error, it’s time to install a local SMTP service (if one is not already installed) and start sending via port.

    Setting the Send and Post Method

    Sending or Posting using the Pickup Directory

    How To Send HTML Formatted Mail Using CDO for Windows 2000 and the Local Pickup Directory

    You can employ the same strategy in the article above to your System.Web.Mail emails:

    How to send e-mail messages by using CDOSYS and the local SMTP pickup directory with VB.NET

    How to use the Cdosys.dll library to send an e-mail message with attachments by using Visual C# (this also shows how to send using pickup)

    Benefits of using the pickup folder

    Performance

    It is very easy to generate a text file on the file system. When your CDOSYS configuration is set to send via pickup, all CDOSYS is doing in your application is creating an .eml file in a specific directory. You’ve just removed the entire networking stack from your application. You can whip through email generation in a fraction of the time it takes to communicate over a TCP port.

    Reliability

    When you let the SMTP service do the sending of your emails, you are working on a far more stable architecture than for you to handle error conditions yourself in your application. IIS’s SMTP service makes it easy when there is a problem as well by just moving your .eml file to the BadMail folder. If the service runs into a problem where transport is too busy to take new connections, it just tries again later. Email is asynchronous by nature, so this shouldn’t be a big deal.

    Resiliency

    The SMTP service will just continually monitor the Pickup folder for any files in it and will try to send them. If there’s a power failure for example, or your machine crashes, when it reboots, the files are still there so the service will once again work on sending them.

    When You Shouldn’t Use Pickup

    If it is impossible for you to install a local SMTP service for whatever reason, sending via port may be your only option. For example, if you are writing an application to run on a desktop running Windows XP/Vista, it doesn’t make sense to install an SMTP service on a desktop platform. Additionally, if your application only sends an email occasionally, it will probably be fine to send using port instead of pickup – you’ll probably never run into this error. If you application does need to know immediately whether or not the email is going to succeed in each command in the protocol (MAIL FROM, RCPTTO, etc) then you may need to send via port as well. In those cases, if you will be sending a large volume of email very quickly, you should throttle your application to allow some time between each mail so that you don’t clog the pipes and end up with the dreaded transport error. This is, of course, assuming that you can’t install SMTP services locally.

    Another reason you may not code your application to use a pickup folder is that you don’t know the environment your application will be deployed on. For example, you’ve written a web application that sends email notifications when some data has changed and you’re going to sell this application for companies to deploy in their own environments. You don’t know, nor can you count on an SMTP service running locally on the box. Your first instinct may be to code your application to send via port. Certainly, they’ll have an SMTP service somewhere in the organization and it’s easy for them to just type in a setting somewhere “mail.company.com” – folks are used to it by now. My plea to you is to account for both possibilities. Provide a mechanism for sending via pickup as well – you won’t regret it.

  • Wiz/dumb

    Understanding How You Use This Blog

    • 0 Comments

    The folks at CTS are asking us to post the following survey to our blogs. You only need to respond once, so if you see this on another blog you read, it's the same thing.

    <survey_text>

    Greetings Blog Readers,

    My name is Ed Jolly, and I am a director in the Commercial Technical Support (CTS) organization at Microsoft. I am here to request a few minutes of your time.

    We would like to learn more about blog readership through a brief survey. This is an opportunity for us to better understand what is valuable to you and what you would like to see in the future.

    Below is a link that will take you to another website to complete the survey. Based on what we learn, we may request more feedback in future surveys like this.  When you open the survey, you will see a list of blogs that CTS engineers contribute to across many different products. We have not posted a listing of these blogs in the past, and I hope it helps you find other blogs that are helpful to you.

    The blog survey is completely anonymous.

    • Location: [Link removed since survey has expired]
    • Availability:  Until August 22. You may receive a request to complete this survey through multiple RSS feeds. You need only to complete it one time.
    • Length: The survey can be a maximum of 11 questions.
    • Time:  Less than 5 minutes (but providing more information in the open text fields may take a minute or two extra, improving our ability to understand your needs in these blogs).

    Thank you in advance for your time, participation and assistance.

    Ed Jolly (edjolly@microsoft.com)

    </survey text>

Page 1 of 1 (4 items)