cancel
Showing results for 
Search instead for 
Did you mean: 

Sending PDF through Email

Former Member
0 Kudos

Hi Every one,

I want to send the PDF file through E-mail using Web Dynpro java,Can any one send me step by step procedure,and tell me how to use the signature field an Interactive form

Thanks ,

vino

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,



	try
	{
	  Properties props = System.getProperties();
	  props.put("mail.smtp.host", smtpServer);
	  Session session = Session.getDefaultInstance(props, null);
	  Message msg = new MimeMessage(session);
	  msg.setFrom(new InternetAddress(from));
	  msg.setRecipients(Message.RecipientType.TO,
	  InternetAddress.parse(to, false));
	  msg.setSubject(subject);
	  msg.setText(body);
	  msg.setHeader("X-Mailer", " Email");
	  msg.setSentDate(new Date());
	  
	  MimeBodyPart messageBodyPart = new MimeBodyPart();
	  messageBodyPart.setText("Sending pdf");
    Multipart multipart = new MimeMultipart();
	  multipart.addBodyPart(messageBodyPart);
	   messageBodyPart = new MimeBodyPart();
	   DataSource source = new FileDataSource("urfile.pdf");
	   messageBodyPart.setDataHandler( new DataHandler(source));
	   messageBodyPart.setFileName("file.pdf");
	   multipart.addBodyPart(messageBodyPart);
 	  msg.setContent(multipart);
	    Transport.send(msg);
	 	}
	catch (Exception ex)
	{
	  ex.printStackTrace();
	}
 

Regards,

Naga

Former Member
0 Kudos

go through dis