| Line 10... |
Line 10... |
| 10 |
import org.apache.logging.log4j.Logger;
|
10 |
import org.apache.logging.log4j.Logger;
|
| 11 |
import org.apache.velocity.app.VelocityEngine;
|
11 |
import org.apache.velocity.app.VelocityEngine;
|
| 12 |
import org.apache.velocity.exception.VelocityException;
|
12 |
import org.apache.velocity.exception.VelocityException;
|
| 13 |
import org.springframework.context.annotation.Bean;
|
13 |
import org.springframework.context.annotation.Bean;
|
| 14 |
import org.springframework.context.annotation.ComponentScan;
|
14 |
import org.springframework.context.annotation.ComponentScan;
|
| - |
|
15 |
import org.springframework.context.annotation.Lazy;
|
| 15 |
import org.springframework.context.annotation.Configuration;
|
16 |
import org.springframework.context.annotation.Configuration;
|
| 16 |
import org.springframework.context.annotation.Primary;
|
17 |
import org.springframework.context.annotation.Primary;
|
| 17 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
18 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 18 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
19 |
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
| 19 |
import org.springframework.core.io.ClassPathResource;
|
20 |
import org.springframework.core.io.ClassPathResource;
|
| 20 |
import org.springframework.core.io.Resource;
|
21 |
import org.springframework.core.io.Resource;
|
| 21 |
import org.springframework.mail.javamail.JavaMailSender;
|
22 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 22 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
23 |
import com.spice.profitmandi.common.services.AuthenticatedIdentityMailSender;
|
| - |
|
24 |
import com.spice.profitmandi.common.services.MailRecipientFilter;
|
| - |
|
25 |
import com.spice.profitmandi.common.services.RecipientFilteringMailSender;
|
| 23 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
26 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 24 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
27 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
| 25 |
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
28 |
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
| 26 |
|
29 |
|
| 27 |
import com.google.gson.Gson;
|
30 |
import com.google.gson.Gson;
|
| Line 122... |
Line 125... |
| 122 |
* From to that identity — Workspace binds an authenticated session to one address
|
125 |
* From to that identity — Workspace binds an authenticated session to one address
|
| 123 |
* and rejects any other. Also answers to "mailSender" so unqualified
|
126 |
* and rejects any other. Also answers to "mailSender" so unqualified
|
| 124 |
* JavaMailSender injections resolve here.
|
127 |
* JavaMailSender injections resolve here.
|
| 125 |
*/
|
128 |
*/
|
| 126 |
@Bean(name = "googleMailSender")
|
129 |
@Bean(name = "googleMailSender")
|
| 127 |
public JavaMailSender googleMailSender() {
|
130 |
public JavaMailSender googleMailSender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 128 |
JavaMailSenderImpl mailSender = new AuthenticatedIdentityMailSender();
|
131 |
AuthenticatedIdentityMailSender mailSender = new AuthenticatedIdentityMailSender();
|
| - |
|
132 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 129 |
mailSender.setHost("smtp.gmail.com");
|
133 |
mailSender.setHost("smtp.gmail.com");
|
| 130 |
mailSender.setPort(465);
|
134 |
mailSender.setPort(465);
|
| 131 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
135 |
mailSender.setUsername("sdtech@smartdukaan.com");
|
| 132 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
136 |
mailSender.setPassword("wbdwyqrcgosrkwdn"); // App Password
|
| 133 |
|
137 |
|
| Line 161... |
Line 165... |
| 161 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
165 |
* Password not accepted". The JVM prefers IPv4, which is the only reason mail
|
| 162 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
166 |
* leaves this box at all. Anything that prefers IPv6 will fail on both paths.
|
| 163 |
*/
|
167 |
*/
|
| 164 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
168 |
@Bean(name = {"gmailRelaySender", "mailSender"})
|
| 165 |
@Primary
|
169 |
@Primary
|
| 166 |
public JavaMailSender getGmailRelaySender() {
|
170 |
public JavaMailSender getGmailRelaySender(@Lazy MailRecipientFilter mailRecipientFilter) {
|
| 167 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
171 |
RecipientFilteringMailSender mailSender = new RecipientFilteringMailSender();
|
| - |
|
172 |
mailSender.setRecipientFilter(mailRecipientFilter);
|
| 168 |
mailSender.setHost("smtp-relay.gmail.com");
|
173 |
mailSender.setHost("smtp-relay.gmail.com");
|
| 169 |
mailSender.setPort(587);
|
174 |
mailSender.setPort(587);
|
| 170 |
|
175 |
|
| 171 |
Properties props = mailSender.getJavaMailProperties();
|
176 |
Properties props = mailSender.getJavaMailProperties();
|
| 172 |
props.put("mail.smtp.starttls.enable", "true");
|
177 |
props.put("mail.smtp.starttls.enable", "true");
|