Subversion Repositories SmartDukaan

Rev

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

Rev 23884 Rev 23909
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.internet.InternetAddress;
-
 
19
import javax.mail.internet.MimeMessage;
-
 
20
 
18
import org.apache.commons.io.FileUtils;
21
import org.apache.commons.io.FileUtils;
19
import org.apache.commons.io.IOUtils;
22
import org.apache.commons.io.IOUtils;
20
import org.apache.http.client.utils.URIBuilder;
23
import org.apache.http.client.utils.URIBuilder;
21
import org.apache.thrift.TException;
24
import org.apache.thrift.TException;
22
import org.apache.thrift.transport.TTransportException;
25
import org.apache.thrift.transport.TTransportException;
23
import org.json.JSONObject;
26
import org.json.JSONObject;
24
import org.apache.logging.log4j.Logger;
27
import org.apache.logging.log4j.Logger;
25
import org.apache.logging.log4j.LogManager;
28
import org.apache.logging.log4j.LogManager;
26
import org.springframework.http.HttpHeaders;
29
import org.springframework.http.HttpHeaders;
27
import org.springframework.http.MediaType;
30
import org.springframework.http.MediaType;
-
 
31
import org.springframework.mail.javamail.JavaMailSender;
-
 
32
import org.springframework.mail.javamail.MimeMessageHelper;
28
 
33
 
29
import com.spice.profitmandi.common.enumuration.SchemeType;
34
import com.spice.profitmandi.common.enumuration.SchemeType;
30
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
35
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
31
import com.spice.profitmandi.common.model.GstRate;
36
import com.spice.profitmandi.common.model.GstRate;
32
import com.spice.profitmandi.common.model.ProfitMandiConstants;
37
import com.spice.profitmandi.common.model.ProfitMandiConstants;
Line 218... Line 223...
218
		finally{
223
		finally{
219
			is.close();
224
			is.close();
220
		}
225
		}
221
	}
226
	}
222
	
227
	
223
	public static void sendMailWithAttachments(String email, String message, List<File> attachments){
228
	public static void sendMailWithAttachments(JavaMailSender mailSender, String emailTo, String[] cc, String subject, String body, List<File> attachments) throws Exception {
-
 
229
		MimeMessage message = mailSender.createMimeMessage();
-
 
230
    	MimeMessageHelper helper = new MimeMessageHelper(message,true);
-
 
231
    	helper.setSubject(subject);
-
 
232
    	helper.setText(body);
-
 
233
    	helper.setCc(cc);
-
 
234
    	helper.setTo(emailTo);
-
 
235
    	InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "ProfitMandi Admin");
-
 
236
    	helper.setFrom(senderAddress);
-
 
237
    	for (File file : attachments) {
-
 
238
    		helper.addAttachment(file.getName(), file);
224
		
239
    	}
-
 
240
    	mailSender.send(message);
225
	}
241
	}
226
	
242
	
227
	public static String[] getOrderStatus(RechargeOrderStatus status){
243
	public static String[] getOrderStatus(RechargeOrderStatus status){
228
		if (status == null){
244
		if (status == null){
229
			status = RechargeOrderStatus.INIT;
245
			status = RechargeOrderStatus.INIT;