Geeks With Blogs
Welcome to
Geeks with Blogs
Login
Gregory Van de Wiele
My Other Recent Posts
Some thoughts on Service Location (SL) and Dependency Injection (DI) with BizTalk...
Biztalk Server AS2 certificates
About compatibility…
BizTalk 2006 SDK: new BaseAdapter
Some great news...
‘Processing convoy workflow scenarios’ patent
BizTalk WMI programming: How to write cleaner WMI code a lot faster
Enterprise Library is -also- there...
The BizTalk SQL Server Adapter isolation level
About publisher policy assembly chaining
Post Categories
Beyond Compare
Team Foundation Server
TFS
My Eclipse
SQL
Java
C#
.NET
javascript
js
Career
Coding Standards
Code Craftsmanship
Archives
February 2010 (1)
December 2009 (1)
September 2009 (1)
August 2009 (2)
July 2009 (1)
June 2009 (2)
May 2009 (2)
February 2009 (1)
December 2008 (1)
September 2005 (2)
April 2005 (1)
March 2005 (2)
February 2005 (1)
November 2004 (4)
October 2004 (2)
September 2004 (4)
El Grego
BizTalk blog
<< BAM Typed API alternative
|
Home
|
Question marks in your flatfile output? >>
BizTalk Arbitrary Binary Email Attachments (or how to fix unreadable attachments)
Comments (4)
|
Share
Recently we have been receiving another series of complaints from clients that had trouble reading the pdf attachment of a BizTalk dynamic generated email. For some years we have been using the MIME encoder pipeline component and dynamically buildup our emails as multi-part message from inside orchestration. We got the mustard from
here
.
As said, it wasn't the first time we had these complaints. But it was always for a small minority of users only. Hence it sounded more like a user-specific issue. Since the smoke kept coming back I decided to start looking for a small fire at our side. Which I think I found:
By default the MIME encoder pipeline component puts 'text/plain' as the MIME content-type.
This will always work if your content is in fact of type 'text', but for all the other types such as a pdf it is not correct in the strict sense.
Success will depend on the mail-client: apparently GMAIL doesn't care that much about it, same story for the majority of our Exchange/Outlook clients. If you want 100% coverage, the only good solution is to specify the correct MIME type for every attachment. For a pdf attachment it should be 'application/pdf':
Please note that the BizTalk 2006/2009 SMTP adapter can take care of the correct MIME encoding (but if the content is already MIME encoded inside the pipeline it is kept intact). According to various blog entries the new SMTP adapter's MIME encoder will take care of setting the correct content-type.
I preferred a small update to my existing code instead of a global rewrite to leverage these new options.
Luckily you can override the MIME encoder's default by specifying the content type of the XLANGPart like this:
part.SetPartProperty(typeof(Microsoft.XLANGs.BaseTypes.ContentType), contentType);
The only thing left to-do is to find out the correct MIME-type per attachment.
I have wrote a small function that does exactly that by using the file extension:
etc...
The default content-type for unknown extensions is "application/octet-stream".
This alone could have been enough to fix the issue but I've tried to put in as much detail and content-types as are documented
here
.
Here is a
sample class
(original sample credits go to
Tomas Restrepo
with content-type update).
Posted on Monday, July 13, 2009 6:35 AM
BizTalk - EAI - B2B
|
Back to top
Related Posts on Geeks With Blogs
Matching Categories
WCF send port behavior
BizTalk - EAI - B2B
RESTful Enterprise Development
BizTalk - EAI - B2B
CharacterTranscoder pipeline component on github.c...
BizTalk - EAI - B2B
Question marks in your flatfile output CONTINUED
BizTalk - EAI - B2B
Question marks in your flatfile output?
BizTalk - EAI - B2B
Comments on this post: BizTalk Arbitrary Binary Email Attachments (or how to fix unreadable attachments)
#
Post number 109 on geekswithblogs.net
Hi there,
Super post, Need to mark it on Digg
GlenStef
Left by
GlenStef
on Jul 13, 2009 10:28 PM
Your comment:
Title:
Name:
Email: (never displayed)
(will show your
gravatar
)
Comment:
Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code
Verification:
Copyright © Gregory Van de Wiele | Powered by:
GeeksWithBlogs.net
Popular Posts on Geeks with Blogs
0
Code Monkey Projectiles - Index
Geeks With Blogs Content Categories
ASP.Net
SQL Server
Apple
Google
SharePoint
Windows
Visual Studio
Team Foundation Server
Agile
Office
Design Patterns
Web
Azure
Brand New Posts on Geeks with Blogs
0
How do you run multiple instances of Microsoft Teams?
Need Something to Do over the Break? How About 25 Free JavaScript Courses?
Benefits of Apple Cider Vinegar
Shaking down the Raspberry Pi 400
Blog is Moving