/*    */ package com.picc.grab.common;
/*    */ 
/*    */ import java.io.File;
/*    */ import javax.mail.internet.MimeMessage;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.core.io.FileSystemResource;
/*    */ import org.springframework.core.io.InputStreamSource;
/*    */ import org.springframework.mail.javamail.JavaMailSenderImpl;
/*    */ import org.springframework.mail.javamail.MimeMessageHelper;
/*    */ import org.springframework.stereotype.Component;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Component
/*    */ public class SendEmailTemplate
/*    */ {
/* 20 */   private static final Logger logger = LoggerFactory.getLogger(SendEmailTemplate.class);
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   @Autowired
/*    */   private JavaMailSenderImpl mailSender;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public void sendMail(final String jszh, final String yjtitle, final String text, final String fjlj, String fsjlid) {
/* 35 */     (new Thread(new Runnable()
/*    */         {
/*    */           public void run() {
/* 38 */             MimeMessage message = SendEmailTemplate.this.mailSender.createMimeMessage();
/*    */             try {
/* 40 */               MimeMessageHelper helper = new MimeMessageHelper(message, true);
/* 41 */               helper.setFrom(SendEmailTemplate.this.mailSender.getUsername());
/* 42 */               helper.setTo(jszh);
/* 43 */               helper.setSubject(yjtitle);
/* 44 */               helper.setText(text);
/*    */               
/* 46 */               FileSystemResource file = new FileSystemResource(new File(fjlj));
/*    */               
/* 48 */               helper.addAttachment("报价单.pdf", (InputStreamSource)file);
/*    */               
/* 50 */               SendEmailTemplate.this.mailSender.send(message);
/* 51 */             } catch (Exception e) {
/* 52 */               SendEmailTemplate.logger.info("----------------------------------- email send error  SendEmailUtil.sendMail MessagingException: " + e.toString());
/*    */             }
/*    */           
/*    */           }
/* 56 */         })).start();
/* 57 */     logger.info("----------------------------------- send email fsjlid: " + fsjlid);
/*    */   }
/*    */ }


/* Location:              C:\Users\Administrator\Desktop\ROOT\WEB-INF\classes\!\com\picc\grab\common\SendEmailTemplate.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */