Send Email using Spring BootSending email in .NET through GmailHow to validate an email address in JavaScript?How to validate an email address using a regular expression?How to configure port for a Spring Boot applicationMail sending -SMTP error with javaMailSenderSending email from Spring Boot application using GmailJava spring boot - JavaMailSender errorsSpring Boot email sending throws SocketTimeoutException: Read timed outsmtp.gmail.com exceptions, enable to send emailSpring Boot - Sending Email using Gmail
When to remove insignificant variables?
Methodology: Writing unit tests for another developer
Improving triangulation on AutoCAD-generated stl files
Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)
Silly doubt about tidal effects and Einstein Field Equations
How does the spell Remove Curse interact with a Sword of Vengeance?
Can humans ever directly see a few photons at a time? Can a human see a single photon?
Is it safe to connect a PoE injector switch to an ordinary PC?
Can Ogre clerics use Purify Food and Drink on humanoid characters?
Should developer taking test phones home or put in office?
Do I have to explain the mechanical superiority of the player-character within the fiction of the game?
Would it be a copyright violation if I made a character’s full name refer to a song?
Understanding the reasoning of the woman who agreed with King Solomon to "cut the baby in half"
Drawing people along with x and y axis
How to find the last non zero element in every column throughout dataframe?
Array initialization optimization
If I wouldn't want to read the story, is writing it still a good idea?
How is hair tissue mineral analysis performed?
Helping ease my back pain when I'm studying 13 hours everyday, even weekends
How do I turn off a repeating trade?
What's the difference between a deep fryer and a chip pan?
Loss of power when I remove item from the outlet
How did Bellatrix know about the Philosopher's Stone?
How to draw this center trajectory of rolling ball?
Send Email using Spring Boot
Sending email in .NET through GmailHow to validate an email address in JavaScript?How to validate an email address using a regular expression?How to configure port for a Spring Boot applicationMail sending -SMTP error with javaMailSenderSending email from Spring Boot application using GmailJava spring boot - JavaMailSender errorsSpring Boot email sending throws SocketTimeoutException: Read timed outsmtp.gmail.com exceptions, enable to send emailSpring Boot - Sending Email using Gmail
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I made a little application to send email with attemet using spring boot, at the first it works, then I had port problem :
"Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1"
I tried to change the port to "465"
.
But I have found the same problem.
What's the matter?
Thanks
spring-boot email
add a comment |
I made a little application to send email with attemet using spring boot, at the first it works, then I had port problem :
"Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1"
I tried to change the port to "465"
.
But I have found the same problem.
What's the matter?
Thanks
spring-boot email
3
Please add code part
– Usman
Mar 25 at 8:49
add a comment |
I made a little application to send email with attemet using spring boot, at the first it works, then I had port problem :
"Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1"
I tried to change the port to "465"
.
But I have found the same problem.
What's the matter?
Thanks
spring-boot email
I made a little application to send email with attemet using spring boot, at the first it works, then I had port problem :
"Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1"
I tried to change the port to "465"
.
But I have found the same problem.
What's the matter?
Thanks
spring-boot email
spring-boot email
edited Mar 25 at 10:06
Vadim Kotov
5,15473550
5,15473550
asked Mar 25 at 8:40
pro educationpro education
12
12
3
Please add code part
– Usman
Mar 25 at 8:49
add a comment |
3
Please add code part
– Usman
Mar 25 at 8:49
3
3
Please add code part
– Usman
Mar 25 at 8:49
Please add code part
– Usman
Mar 25 at 8:49
add a comment |
1 Answer
1
active
oldest
votes
I`m using spring-boot-starter-mail 2.0.4.RELEASE in this code.
I use this Configuration for smtp.gmail.com.
@Configuration
public class EmailSenderConfig
@Value("$mail.login")
private String login;
@Value("$mail.password")
private String password;
@Bean
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.gmail.com");
mailSender.setPort(587);
mailSender.setUsername(login); //login for google account "this.my.email@gmail.com"
mailSender.setPassword(password); // password for google account "thisMyPassword666"
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
And this code for sending messages
@Autowired
private JavaMailSender mailSender;
public void sendToken(String to)
SimpleMailMessage smm = new SimpleMailMessage();
String token = String.valueOf(new Random().ints(MIN, MAX).findFirst().getAsInt());
verificationService.saveTemporaryToken(to, token);
smm.setTo(to);
smm.setSubject(TITLE);
smm.setText(token);
mailSender.send(smm);
Compare my code and your, maybe you forgot to write something.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333947%2fsend-email-using-spring-boot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I`m using spring-boot-starter-mail 2.0.4.RELEASE in this code.
I use this Configuration for smtp.gmail.com.
@Configuration
public class EmailSenderConfig
@Value("$mail.login")
private String login;
@Value("$mail.password")
private String password;
@Bean
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.gmail.com");
mailSender.setPort(587);
mailSender.setUsername(login); //login for google account "this.my.email@gmail.com"
mailSender.setPassword(password); // password for google account "thisMyPassword666"
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
And this code for sending messages
@Autowired
private JavaMailSender mailSender;
public void sendToken(String to)
SimpleMailMessage smm = new SimpleMailMessage();
String token = String.valueOf(new Random().ints(MIN, MAX).findFirst().getAsInt());
verificationService.saveTemporaryToken(to, token);
smm.setTo(to);
smm.setSubject(TITLE);
smm.setText(token);
mailSender.send(smm);
Compare my code and your, maybe you forgot to write something.
add a comment |
I`m using spring-boot-starter-mail 2.0.4.RELEASE in this code.
I use this Configuration for smtp.gmail.com.
@Configuration
public class EmailSenderConfig
@Value("$mail.login")
private String login;
@Value("$mail.password")
private String password;
@Bean
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.gmail.com");
mailSender.setPort(587);
mailSender.setUsername(login); //login for google account "this.my.email@gmail.com"
mailSender.setPassword(password); // password for google account "thisMyPassword666"
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
And this code for sending messages
@Autowired
private JavaMailSender mailSender;
public void sendToken(String to)
SimpleMailMessage smm = new SimpleMailMessage();
String token = String.valueOf(new Random().ints(MIN, MAX).findFirst().getAsInt());
verificationService.saveTemporaryToken(to, token);
smm.setTo(to);
smm.setSubject(TITLE);
smm.setText(token);
mailSender.send(smm);
Compare my code and your, maybe you forgot to write something.
add a comment |
I`m using spring-boot-starter-mail 2.0.4.RELEASE in this code.
I use this Configuration for smtp.gmail.com.
@Configuration
public class EmailSenderConfig
@Value("$mail.login")
private String login;
@Value("$mail.password")
private String password;
@Bean
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.gmail.com");
mailSender.setPort(587);
mailSender.setUsername(login); //login for google account "this.my.email@gmail.com"
mailSender.setPassword(password); // password for google account "thisMyPassword666"
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
And this code for sending messages
@Autowired
private JavaMailSender mailSender;
public void sendToken(String to)
SimpleMailMessage smm = new SimpleMailMessage();
String token = String.valueOf(new Random().ints(MIN, MAX).findFirst().getAsInt());
verificationService.saveTemporaryToken(to, token);
smm.setTo(to);
smm.setSubject(TITLE);
smm.setText(token);
mailSender.send(smm);
Compare my code and your, maybe you forgot to write something.
I`m using spring-boot-starter-mail 2.0.4.RELEASE in this code.
I use this Configuration for smtp.gmail.com.
@Configuration
public class EmailSenderConfig
@Value("$mail.login")
private String login;
@Value("$mail.password")
private String password;
@Bean
public JavaMailSender getJavaMailSender()
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("smtp.gmail.com");
mailSender.setPort(587);
mailSender.setUsername(login); //login for google account "this.my.email@gmail.com"
mailSender.setPassword(password); // password for google account "thisMyPassword666"
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
return mailSender;
And this code for sending messages
@Autowired
private JavaMailSender mailSender;
public void sendToken(String to)
SimpleMailMessage smm = new SimpleMailMessage();
String token = String.valueOf(new Random().ints(MIN, MAX).findFirst().getAsInt());
verificationService.saveTemporaryToken(to, token);
smm.setTo(to);
smm.setSubject(TITLE);
smm.setText(token);
mailSender.send(smm);
Compare my code and your, maybe you forgot to write something.
answered Mar 25 at 10:37
zdadcozdadco
685
685
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55333947%2fsend-email-using-spring-boot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Please add code part
– Usman
Mar 25 at 8:49