For the following examples, I assume you've already created 2 multipart messages EmailIn and EmailOut, each with a body part and an attachment part called Remainder. EmailIn has been used to receive an email using the POP3 adapter (see my previous post), and EmailOut is for sending an email out via SMTP. I also assume that you've at least partly built the EmailOut message, see the 2 links above if you don't know how.
To set the filename for the attachment:
EmailOut.Remainder(MIME.FileName) = "MySpecialTitle.XML";
To set the subject of the outgoing email from the incoming email:
EmailOut(SMTP.Subject) = EmailIn(POP3.Subject);
By the way, these need to be done in a constructor for EmailOut.
To send your email to an address that is to be configured at run-time, assuming that you've managed to get the correct address into the variable emailAddress:
- Creating a dyamic port
- Create an expression shape
- Enter code that looks like this in the expression shape:
DynamicPort(Microsoft.XLANGs.BaseTypes.Address) = "mailto:" + emailAddress;
It took me a while to figure out how this could work, my guess is that the "mailto:" prefix somehow indicates to BizTalk that it should use SMTP for that port, just as http tells your browser to use port 80.
Hopefully you can extrapolate other things that you might need from the links and these examples.