on 10-20-2009 6:48 AM
Hi All,
I want to formulate a MIME message in NetweaverXI. The MIME messsage will contain a cXML and an attachment. Then send the message to a JCA adapter.
Similarly when the JCA adapter sends a MIME message i want to parse it and get access to each part of the MIME message.
Is there any support available for MIME in NetweaverXI? Are there any sample examples for the same?
The message will be in the below format.
--Bouundary
Content-Type: text/xml; charset=UTF-8
Content-ID: 1255070783528.1638087094
<cXML>
.....
.....
<Attachment>
<url> AAAAA</url>
</Attachment>
</cXML>
--Bouundary
Content-Type: text/xml; charset=UTF-8
Content-ID: AAAAA
Attachment
Bouundary
Any help will be really appreciated.
Thanks
Hi Ameeth,
Please check the link below:
/people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
Also, Mail can be processed using Java Mail API. Below is the code snippet send mail.
public static boolean sendMail(String mailHost, String toAddress ,String fromAddress, String ccAddress,String subject,String mailbody,String attachmentContent,String attachmentName,MessageKey messageKey, AuditAccess audit) throws MessagingException{
String subloc = "JavaMailSender.sendMail()";
PIFTWrapper.entering(subloc);
audit.addAuditLogEntry(messageKey, AuditLogStatus.SUCCESS, "Sending Mail to SMTP server");
Properties properties = new Properties();
properties.setProperty("mail.smtp.host", mailHost);
Session session = Session.getInstance(properties,null);
MimeMessage mimeMessage = new MimeMessage(session);
mimeMessage.setFrom(new InternetAddress(fromAddress));
mimeMessage.setRecipients(RecipientType.TO, toAddress);
mimeMessage.setRecipients(RecipientType.CC, ccAddress);
mimeMessage.setSubject(subject);
mimeMessage.setSentDate(new Date());
MimeBodyPart contentMimeBodyPart = new MimeBodyPart();
contentMimeBodyPart.setDisposition(MimeMessage.INLINE);
contentMimeBodyPart.setText(mailbody);
MimeBodyPart attachmentMimeBodyPart = new MimeBodyPart();
attachmentMimeBodyPart.setDisposition(MimeMessage.ATTACHMENT);
attachmentMimeBodyPart.setFileName(attachmentName);
attachmentMimeBodyPart.setText(attachmentContent);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(contentMimeBodyPart);
multipart.addBodyPart(attachmentMimeBodyPart);
mimeMessage.setContent(multipart);
mimeMessage.saveChanges();
Transport.send(mimeMessage);
PIFTWrapper.exiting();
audit.addAuditLogEntry(messageKey, AuditLogStatus.SUCCESS, "Mail Sent");
return true;
}
Similar processing can be done using Java Mail API for incomming messages.
Regards,
Sumant
Edited by: SumantKRaja on Oct 20, 2009 8:07 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.