Subversion Repositories SmartDukaan

Rev

Rev 25764 | Rev 25767 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25764 Rev 25766
Line 13... Line 13...
13
import java.util.List;
13
import java.util.List;
14
import java.util.Map;
14
import java.util.Map;
15
import java.util.Set;
15
import java.util.Set;
16
import java.util.TreeSet;
16
import java.util.TreeSet;
17
 
17
 
-
 
18
import javax.mail.Multipart;
18
import javax.mail.internet.InternetAddress;
19
import javax.mail.internet.InternetAddress;
19
import javax.mail.internet.MimeBodyPart;
20
import javax.mail.internet.MimeBodyPart;
20
import javax.mail.internet.MimeMessage;
21
import javax.mail.internet.MimeMessage;
-
 
22
import javax.mail.internet.MimeMultipart;
21
 
23
 
22
import org.apache.commons.io.FileUtils;
24
import org.apache.commons.io.FileUtils;
23
import org.apache.commons.io.IOUtils;
25
import org.apache.commons.io.IOUtils;
24
import org.apache.http.client.utils.URIBuilder;
26
import org.apache.http.client.utils.URIBuilder;
25
import org.apache.logging.log4j.LogManager;
27
import org.apache.logging.log4j.LogManager;
Line 555... Line 557...
555
	public static WarehouseAddress getWarehouseByWarehouseId(int warehouseAddressId) throws Exception {
557
	public static WarehouseAddress getWarehouseByWarehouseId(int warehouseAddressId) throws Exception {
556
		TransactionClient tcl = new TransactionClient();
558
		TransactionClient tcl = new TransactionClient();
557
		return tcl.getClient().getWarehouseAddress((long) warehouseAddressId);
559
		return tcl.getClient().getWarehouseAddress((long) warehouseAddressId);
558
	}
560
	}
559
 
561
 
560
	public static void sendEmbeddedHtmlMail(JavaMailSender mailSender, String[] strings, String[] strings2,
562
	public static void sendEmbeddedHtmlMail(JavaMailSender mailSender, String[] emailTo, String[] cc, String subject,
561
			String format, String string, Map<? extends Serializable, File> map) throws Exception {
563
			String body, Map<? extends Serializable, File> map) throws Exception {
-
 
564
		MimeMessage message = mailSender.createMimeMessage();
-
 
565
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
-
 
566
		helper.setSubject(subject);
-
 
567
		Multipart mp = new MimeMultipart();
-
 
568
		
-
 
569
		MimeBodyPart messageBodyPart = new MimeBodyPart();
-
 
570
        messageBodyPart.setContent(body, "text/html");
-
 
571
		mp.addBodyPart(messageBodyPart);
-
 
572
		
-
 
573
		// helper.setText(body, true);
-
 
574
		if (cc != null) {
-
 
575
			helper.setCc(cc);
-
 
576
		}
-
 
577
		helper.setTo(emailTo);
-
 
578
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
-
 
579
		helper.setFrom(senderAddress);
-
 
580
		mailSender.send(message);
562
		for(Map.Entry<? extends Serializable, File> entry: map.entrySet()) {
581
		for (Map.Entry<? extends Serializable, File> entry : map.entrySet()) {
563
			entry.getKey();
582
			entry.getKey();
564
			entry.getValue();
583
			entry.getValue();
565
			MimeBodyPart imagePart = new MimeBodyPart();
584
			MimeBodyPart imagePart = new MimeBodyPart();
566
			imagePart.setHeader("Content-ID", entry.getKey() + "");
585
			imagePart.setHeader("Content-ID", entry.getKey() + "");
567
			imagePart.setDisposition(MimeBodyPart.INLINE);
586
			imagePart.setDisposition(MimeBodyPart.INLINE);
568
			imagePart.attachFile(entry.getValue());
587
			imagePart.attachFile(entry.getValue());
-
 
588
			mp.addBodyPart(imagePart);
-
 
589
 
569
		}
590
		}
570
		// attach the image file
591
		message.setContent(mp, "text/html");
571
 
592
 
572
	}
593
	}
573
 
594
 
574
}
595
}