Sending Mail Using MIME
This sample shows how to send mail with attachments using MIME format.
The MailSender.bwp process sends mail with attachments and the MailReceiver.bwp process receives the mail.
MailSender Process
![](GUID-59B6BBEF-9B3B-4DE6-BCA7-B995A9916F84-display.png)
MailReceiver Process
![](GUID-3847123F-BAB3-4F67-BDCE-826851E0B779-display.png)
Prerequisites
You must have the account settings for your mail server.
On Windows, copy the input folder from $TIBCO_HOME\bw\n.n\samples\palette\mail\attachment_files folder to C:\tmp.
On UNIX, copy the input folder to /tmp.
Procedure
Result
The MailSender process sends the mail and the MailReceiver process receives the mail.
On Windows, the MIMEAttachment.log output file is created at c:/tmp/MIMEAttachment.
On UNIX, the output file is created at \tmp\MIMEAttachment.
The Console view shows the messages similar to:
13:25:01.277 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.m.M.Log - Sending the mail with attachment
13:25:03.984 INFO [bwThread:In-Memory STWorkProcessor-1] c.t.b.p.g.L.t.b.s.p.m.M.Log1 - Mail has been sent with attachment
13:25:13.471 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log - Received Mail with subject: Test Mail With Attachment
13:25:13.476 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log1 - Mail Body: Hello World
13:25:13.538 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log2 - Attachment [1] data:
13:25:13.591 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log3 - Test Attachment Data
13:25:13.631 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log2 - Attachment [2] data:
13:25:13.656 INFO [bwThread:In-Memory STWorkProcessor-2] c.t.b.p.g.L.t.b.s.p.m.M.Log4 - R0lGODlheQA2APcAAAAAAP///wBtpQ8KCxALDBMODxYREhcSExoVFhAMDRMPEBQQERgUFRkVFhoWFxANDhEOD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