Jump to content

Emailing Excel as an attchment.


shivamadagani

Recommended Posts

Hi,

can any one tell me how can i add my excel file(jasper report extracted) as attchement, to send an email from spring.

Thanks

Shiva

Code:
//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

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...