| Line 13... |
Line 13... |
| 13 |
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
13 |
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
| 14 |
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
|
14 |
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
|
| 15 |
import com.google.gson.Gson;
|
15 |
import com.google.gson.Gson;
|
| 16 |
import com.google.gson.GsonBuilder;
|
16 |
import com.google.gson.GsonBuilder;
|
| 17 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
17 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
| - |
|
18 |
import com.spice.profitmandi.common.services.MailRecipientFilter;
|
| - |
|
19 |
import com.spice.profitmandi.common.services.RecipientFilteringMailSender;
|
| 18 |
import com.spice.profitmandi.common.util.Utils;
|
20 |
import com.spice.profitmandi.common.util.Utils;
|
| 19 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
|
21 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
|
| 20 |
import org.apache.logging.log4j.LogManager;
|
22 |
import org.apache.logging.log4j.LogManager;
|
| 21 |
import org.apache.logging.log4j.Logger;
|
23 |
import org.apache.logging.log4j.Logger;
|
| 22 |
import org.apache.velocity.app.VelocityEngine;
|
24 |
import org.apache.velocity.app.VelocityEngine;
|
| 23 |
import org.apache.velocity.exception.VelocityException;
|
25 |
import org.apache.velocity.exception.VelocityException;
|
| 24 |
import org.springframework.context.annotation.Bean;
|
26 |
import org.springframework.context.annotation.Bean;
|
| 25 |
import org.springframework.context.annotation.ComponentScan;
|
27 |
import org.springframework.context.annotation.ComponentScan;
|
| - |
|
28 |
import org.springframework.context.annotation.Lazy;
|
| 26 |
import org.springframework.context.annotation.Configuration;
|
29 |
import org.springframework.context.annotation.Configuration;
|
| 27 |
import org.springframework.context.annotation.Primary;
|
30 |
import org.springframework.context.annotation.Primary;
|
| 28 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
31 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 29 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
32 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
| 30 |
import org.springframework.core.io.ClassPathResource;
|
33 |
import org.springframework.core.io.ClassPathResource;
|
| Line 224... |
Line 227... |
| 224 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
227 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
| 225 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
228 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
| 226 |
*/
|
229 |
*/
|
| 227 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
230 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
| 228 |
@Primary
|
231 |
@Primary
|
| 229 |
public JavaMailSender getGmailRelaySender() {
|
232 |
public JavaMailSender getGmailRelaySender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 230 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
233 |
RecipientFilteringMailSender mailSender = new RecipientFilteringMailSender();
|
| - |
|
234 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 231 |
mailSender.setHost("smtp-relay.gmail.com");
|
235 |
mailSender.setHost("smtp-relay.gmail.com");
|
| 232 |
mailSender.setPort(587);
|
236 |
mailSender.setPort(587);
|
| 233 |
|
237 |
|
| 234 |
Properties props = mailSender.getJavaMailProperties();
|
238 |
Properties props = mailSender.getJavaMailProperties();
|
| 235 |
props.put("mail.smtp.starttls.enable", "true");
|
239 |
props.put("mail.smtp.starttls.enable", "true");
|
| Line 251... |
Line 255... |
| 251 |
* From to that identity — Workspace binds an authenticated session to one address
|
255 |
* From to that identity — Workspace binds an authenticated session to one address
|
| 252 |
* and rejects any other. Also answers to "mailSender" so unqualified
|
256 |
* and rejects any other. Also answers to "mailSender" so unqualified
|
| 253 |
* JavaMailSender injections resolve here.
|
257 |
* JavaMailSender injections resolve here.
|
| 254 |
*/
|
258 |
*/
|
| 255 |
@Bean(name = "googleMailSender")
|
259 |
@Bean(name = "googleMailSender")
|
| 256 |
public JavaMailSender googleMailSender() {
|
260 |
public JavaMailSender googleMailSender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 257 |
JavaMailSenderImpl mailSender = new AuthenticatedIdentityMailSender();
|
261 |
AuthenticatedIdentityMailSender mailSender = new AuthenticatedIdentityMailSender();
|
| - |
|
262 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 258 |
mailSender.setHost("smtp.gmail.com");
|
263 |
mailSender.setHost("smtp.gmail.com");
|
| 259 |
mailSender.setPort(465);
|
264 |
mailSender.setPort(465);
|
| 260 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
265 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
| 261 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
266 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
| 262 |
|
267 |
|