| Line 32... |
Line 32... |
| 32 |
import org.springframework.boot.WebApplicationType;
|
32 |
import org.springframework.boot.WebApplicationType;
|
| 33 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
33 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 34 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
34 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
| 35 |
import org.springframework.context.annotation.Bean;
|
35 |
import org.springframework.context.annotation.Bean;
|
| 36 |
import org.springframework.context.annotation.ComponentScan;
|
36 |
import org.springframework.context.annotation.ComponentScan;
|
| - |
|
37 |
import org.springframework.context.annotation.Lazy;
|
| 37 |
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
38 |
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
| 38 |
import org.springframework.context.annotation.Primary;
|
39 |
import org.springframework.context.annotation.Primary;
|
| 39 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
40 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 40 |
import org.springframework.core.io.ClassPathResource;
|
41 |
import org.springframework.core.io.ClassPathResource;
|
| 41 |
import org.springframework.core.io.Resource;
|
42 |
import org.springframework.core.io.Resource;
|
| 42 |
import org.springframework.mail.javamail.JavaMailSender;
|
43 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 43 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
44 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
| - |
|
45 |
import com.spice.profitmandi.common.services.MailRecipientFilter;
|
| - |
|
46 |
import com.spice.profitmandi.common.services.RecipientFilteringMailSender;
|
| 44 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
47 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 45 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
48 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
| 46 |
|
49 |
|
| 47 |
import java.io.FileInputStream;
|
50 |
import java.io.FileInputStream;
|
| 48 |
import java.io.IOException;
|
51 |
import java.io.IOException;
|
| Line 187... |
Line 190... |
| 187 |
*
|
190 |
*
|
| 188 |
* Also answers to "mailSender" so the many unqualified JavaMailSender
|
191 |
* Also answers to "mailSender" so the many unqualified JavaMailSender
|
| 189 |
* injections resolve here rather than needing to be touched.
|
192 |
* injections resolve here rather than needing to be touched.
|
| 190 |
*/
|
193 |
*/
|
| 191 |
@Bean(name = "googleMailSender")
|
194 |
@Bean(name = "googleMailSender")
|
| 192 |
public JavaMailSender googleMailSender() {
|
195 |
public JavaMailSender googleMailSender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 193 |
JavaMailSenderImpl mailSender = new AuthenticatedIdentityMailSender();
|
196 |
AuthenticatedIdentityMailSender mailSender = new AuthenticatedIdentityMailSender();
|
| - |
|
197 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 194 |
mailSender.setHost("smtp.gmail.com");
|
198 |
mailSender.setHost("smtp.gmail.com");
|
| 195 |
mailSender.setPort(465);
|
199 |
mailSender.setPort(465);
|
| 196 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
200 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
| 197 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
201 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
| 198 |
|
202 |
|
| Line 226... |
Line 230... |
| 226 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
230 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
| 227 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
231 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
| 228 |
*/
|
232 |
*/
|
| 229 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
233 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
| 230 |
@Primary
|
234 |
@Primary
|
| 231 |
public JavaMailSender getGmailRelaySender() {
|
235 |
public JavaMailSender getGmailRelaySender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 232 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
236 |
RecipientFilteringMailSender mailSender = new RecipientFilteringMailSender();
|
| - |
|
237 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 233 |
mailSender.setHost("smtp-relay.gmail.com");
|
238 |
mailSender.setHost("smtp-relay.gmail.com");
|
| 234 |
mailSender.setPort(587);
|
239 |
mailSender.setPort(587);
|
| 235 |
|
240 |
|
| 236 |
Properties props = mailSender.getJavaMailProperties();
|
241 |
Properties props = mailSender.getJavaMailProperties();
|
| 237 |
props.put("mail.smtp.starttls.enable", "true");
|
242 |
props.put("mail.smtp.starttls.enable", "true");
|
| Line 472... |
Line 477... |
| 472 |
}
|
477 |
}
|
| 473 |
if (args.containsOption("processActivation")) {
|
478 |
if (args.containsOption("processActivation")) {
|
| 474 |
scheduledTasks.processActivation();
|
479 |
scheduledTasks.processActivation();
|
| 475 |
System.exit(0);
|
480 |
System.exit(0);
|
| 476 |
}
|
481 |
}
|
| 477 |
if (args.containsOption("sendAttendanceMorningAlert")) {
|
- |
|
| 478 |
scheduledTasks.sendAttendanceMorningAlert();
|
- |
|
| 479 |
System.exit(0);
|
- |
|
| 480 |
}
|
- |
|
| 481 |
if (args.containsOption("sendAttendanceEveningAlert")) {
|
- |
|
| 482 |
scheduledTasks.sendAttendanceEveningAlert();
|
- |
|
| 483 |
System.exit(0);
|
- |
|
| 484 |
}
|
- |
|
| 485 |
|
482 |
|
| 486 |
if (args.containsOption("checkRazorPayPaymentStatus")) {
|
483 |
if (args.containsOption("checkRazorPayPaymentStatus")) {
|
| 487 |
scheduledTasks.checkRazorPayPaymentStatus();
|
484 |
scheduledTasks.checkRazorPayPaymentStatus();
|
| 488 |
System.exit(0);
|
485 |
System.exit(0);
|
| 489 |
}
|
486 |
}
|