|
Home > Archive > BizTalk Server General > June 2006 > Handling attachments with the Pop3 adapter
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Handling attachments with the Pop3 adapter
|
|
| tasman 2006-05-16, 7:13 am |
| I'm trying to create an orchestration which can pickup emails using the
pop3 adapter. The emails can contain an unknown number of attachments
of unknown type. I would like to be able to strip the attachments and
save them into a WSS Doc Lib.
What I am having trouble with is trying to figure out how to get all
the attachments out. At the moment im trying to set up a loop which
will call a pipeline to do the mime decoding. Am I going in the right
direction here? Can i preserve the filenames of the attachmentstoo?
Thanks
| |
| tasman 2006-05-18, 7:18 am |
| I should add that im using biztalk 2006 and the inbuilt adapters
| |
| tasman 2006-05-23, 7:15 am |
| OK there has been no takers on my problem so what I'll do is post the
solution that I have thus far.
I have found a way to partially solve the problem. I can now process
emails with up to 10 attachments of any type.
The solution can be extended to handle more but I figured that this was
a reasonable limit to set it at.
I'm using a Receive port with a POP3 adapter to rip emails off an
exchange server.
POP3 Receive Port settings:
Apply MIME Encoding = False (If I set this to true then I can't get out
all the attachments later in the orchestration)
Body Part Index = 0
Content Type is left blank
The encoded MIME message then gets handled in my orchestration. I have
configured 10 pipelines using the MIME decoder with the body part index
set from 1 to 10. These pipelines get called from my orchestration in a
series of message construction/message assignment shapes.
>From each pipeline comes back the decoded attachment as a biztalk
message. I then call a method from a custom assembly which will extract
the filename for me like so:
public string GetBodyPartName(XLANGMessage Message)
{
try
{
string BodyPartName = "";
BodyPartName = Message[0].Name;
return BodyPartName;
}
catch (Exception Ex)
{
return "";
}
}
Using the WSS adapter on a send port I can now send the attachments to
a document library and save them using their original file name.
This solution works fine for me but I am very open for any tips on how
to improve it. I would really like to know for example if there is a
way to dynamically configure pipelines so I do not need to create and
manage 10 pipelines?
This would dramatically improve the manageability of the solution as I
could use a loop structure to call the pipeline and increment the body
part index on the MIME decoder.
Tasman
| |
| Julien 2006-06-01, 7:15 am |
| Hi Tasman,
I have a similar issue I would like to resolve ; if you could help, I
would really appreciate :
The situation is simple : An email is incoming on a mail server, which
is polled by the POP3 adapter. This email is plain text and contains
one attachement, which is plain text as well. I want the Biztalk
solution to extract the from/to/subject from the body, and the
attachement content from the attachement. This info should then end up
in a XML file, where the from tag is the from value, the to tag is the
to value, etc...using a schema. How would I do that ?
Thanks in advance for any help.
Julien
| |
| Tasman Bleechmore 2006-06-09, 7:18 am |
| Hi Julien,
I've replied to you via email as well but i'll post here too for
others.
sorry for the late reply, i have just started a new project so have
been a little distracted. I have struggled with Biztalk for a while now
so Im happy to try and help you out as much as possible.
I dont have it with me right now but I will send you the solution i
developed so you can look at that.
In order to get the To, From, subject details off the email you need to
set mime decoding to true on the POP3 adapter.
To get the attachment you need to set the body part index to 1 on the
POP3 adapter then extract the attachment by calling a pipeline in your
orchestration (check my solution)
One issue i see you having is with the creation of your XML document.
The incoming email has no schema specification so you cant map the
properties from the email to your XML. The only solution here as I see
it is to simply create an xml document in your orchestration as a text
string and embed the property information. You can see an example of
this too in my code, here i am creating an infopath xml document and
adding some values to it.
Hope this helps
Tasman
Julien wrote:
> Hi Tasman,
>
> I have a similar issue I would like to resolve ; if you could help, I
> would really appreciate :
>
> The situation is simple : An email is incoming on a mail server, which
> is polled by the POP3 adapter. This email is plain text and contains
> one attachement, which is plain text as well. I want the Biztalk
> solution to extract the from/to/subject from the body, and the
> attachement content from the attachement. This info should then end up
> in a XML file, where the from tag is the from value, the to tag is the
> to value, etc...using a schema. How would I do that ?
>
>
> Thanks in advance for any help.
> Julien
|
|
|
|
|