Subversion Repositories SmartDukaan

Rev

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

Rev 26978 Rev 26989
Line 496... Line 496...
496
	public static String getHyphenatedString(String s) {
496
	public static String getHyphenatedString(String s) {
497
		s = s.trim().replaceAll("\\s+", " ");
497
		s = s.trim().replaceAll("\\s+", " ");
498
		s = s.replaceAll("\\s", "-");
498
		s = s.replaceAll("\\s", "-");
499
		return s.toLowerCase();
499
		return s.toLowerCase();
500
	}
500
	}
-
 
501
	
-
 
502
	public static void sendMailWithAttachments(JavaMailSender mailSender, String[] emailTo, String[] cc, String subject,
-
 
503
			String body, Attachment... attachments) throws Exception {
-
 
504
		MimeMessage message = mailSender.createMimeMessage();
-
 
505
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
-
 
506
		helper.setSubject(subject);
-
 
507
		helper.setText(body);
-
 
508
		if (cc != null) {
-
 
509
			helper.setCc(cc);
-
 
510
		}
-
 
511
		helper.setTo(emailTo);
-
 
512
		for (Attachment attachment : attachments) {
-
 
513
			helper.addAttachment(attachment.getFileName(), attachment.getInputStreamSource());
-
 
514
		}
-
 
515
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
-
 
516
		helper.setFrom(senderAddress);
-
 
517
		mailSender.send(message);
-
 
518
	}
501
 
519
 
502
}
520
}
503
521