on 10-13-2006 11:40 AM
Hi All,
Developing a webdynpro application in Java Which will sending -mail.Is it Possible to send attachments[Ex: Excel/doc Files] in webdynpro ?How to do it ?Please Help me out..
Regards,
Ramganesh.
Hi,
Try this code;
Properties properties = new Properties();
properties.put( "mail.smtp.host", <>);
Session session = Session.getInstance( properties, null);
MimeMessage message = new MimeMessage( session);
try
{
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodypart = new MimeBodyPart();
message.setFrom( new InternetAddress( <sender mail id>));
message.setRecipient( Message.RecipientType.TO, new InternetAddress( wdContext.currentContextElement().getP_Email_Id()));
message.setSubject( "Subject");
messageBodypart.setText( "Text");
multipart.addBodyPart( messageBodypart);
messageBodypart = new MimeBodyPart();
messageBodypart.setDataHandler( new DataHandler( new FileDataSource( <Path of file>)));
messageBodypart.setFileName( new FileDataSource( <Path of file>).getName());
messageBodypart.setHeader( "Content-Type", "application/pdf");
multipart.addBodyPart( messageBodypart);
message.setContent( multipart);
Transport.send( message);
} catch (AddressException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (MessagingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Regards
Vinod V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramganesan Karuppaiyah ,
refer the following links
[http://help.sap.com/erp2005_ehp_03/helpdata/EN/8d/6bd83e8cb23d67e10000000a114084/frameset.htm|http://help.sap.com/erp2005_ehp_03/helpdata/EN/8d/6bd83e8cb23d67e10000000a114084/frameset.htm]
[https://forums.sdn.sap.com/click.jspa?searchID=1063990&messageID=1486766|https://forums.sdn.sap.com/click.jspa?searchID=1063990&messageID=1486766]
points if useful
thanks
suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.