We have an SAP product that will be implemented soon. They have the option of sending us files through SMTP.
How do we go about extracting the attachments? Any sample code would be greatly appreciated.
Tags:
Hi Carlos. To receive the messages from SAP, you would use the POP3 adapter and connect it to email account that SAP will send emails to.
The POP3 adapter stores the emails in a Neuron.Esb.Mail.EmailMessage object (Neuron.Esb.dll), and then stores the EmailMessage object as the body of the ESBMessage object that we send to topics.
To get the attachments, you would do something like this in a code step:
var emailMessage = context.Data.GetBody<Neuron.Esb.Mail.EmailMessage>();
foreach (var attachment in emailMessage.Attachments)
{
// TODO: do something with the message.
// attachment.Name has the file name
// attachment.Content is a byte array containing the attachment data
// attachment.Length is the number of bytes in Content
}
I hope that this helps. Let me know if you have issues with this.
Neuron ESB Product Support Forums and Communities
© 2024 Created by Neuron Admin. Powered by