shivamadagani Posted December 27, 2010 Share Posted December 27, 2010 Hi,can any one tell me how can i add my excel file(jasper report extracted) as attchement, to send an email from spring.ThanksShivaCode://finalResp is xml data which we ll use to fill excel fileInputStream in = new ByteArrayInputStream(finalResp.getBytes()); org.springframework.core.io.InputStreamSource inputStreamSource=?????JavaMailSenderImpl mailSender = new JavaMailSenderImpl();mailSender.setHost("some host"); MimeMessage message = mailSender.createMimeMessage();MimeMessageHelper helper = new MimeMessageHelper(message, true);helper.setFrom(from);helper.setTo(to);helper.setSubject(sub);helper.addAttachment(attachmentFilename, inputStreamSource, contentType);helper.setText("Please check attachment",true);mailSender.send(message); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now