In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use QQ Mail to send e-mail, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
QQ Mail opens the POP3/SMTP service
After the above service is enabled, you will get a string of authorization passwords that need to be used in the springboot configuration.
II. Springboot configuration
IDE directory
1. Add spring-boot-starter-mail start-up dependency in pom.xml
Org.springframework.boot spring-boot-starter-mail
two。 Configure the mail property in application.properties
# static resource mapping, localhost:8080/ = / resourcesspring.resources.static-locations=classpath:META-INF/resources/,classpath:static/,classpath:templates/# https://blog.csdn.net/jawhiow/article/details/82625842# if the address that previously visited the home page is: http://localhost:8888/index.html, then after you configure this configuration Http://localhost:8888/default/index.htmlspring.mvc.static-path-pattern=/*# sets mailbox host spring.mail.host=smtp.qq.com# sets username spring.mail.username=xxxxxx@qq.com# sets password, the password here is the authorization code of QQ Mail to open SMTP instead of QQ password, whether authentication is required for spring.mail.password=xxxxxx# setting, if true, then username and password are required, # if false is set You don't have to set a user name and password, and of course it depends on whether your docking platform supports access without a password. Spring.mail.properties.mail.smtp.auth=true# STARTTLS [1] is an extension of plain text communication protocol. It provides a way to upgrade a plain text connection to an encrypted connection (TLS or SSL) instead of using a separate port for encrypted communication. Spring.mail.properties.mail.smtp.starttls.enable=truespring.mail.properties.mail.smtp.starttls.required=truespring.mail.properties.mail.smtp.ssl.enable=truespring.mail.port=465
3. Write controller files
@ Controllerpublic class EmailController {@ Autowired private JavaMailSender javaMailSender; @ RequestMapping ("/") public void index (HttpServletRequest request, HttpServletResponse response) throws IOException {System.out.println ("index.html"); response.sendRedirect ("/ index.html");} @ ResponseBody @ RequestMapping ("/ emailSend") public String emailSend (@ RequestParam (value = "email") String eamil) {System.out.println (eamil); String content = "1234" Try {SimpleMailMessage message = new SimpleMailMessage (); message.setFrom ("xxxxxx@qq.com"); message.setTo (eamil); message.setSubject ("subject: subject content"); message.setText (content); / / send email javaMailSender.send (message); System.out.println (eamil+ "sent successfully") } catch (Exception e) {return "fail";} return "success";}}
4. Write a web page
Email address:
5. Sent successfully
The above is all the contents of the article "how to use QQ Mail to send email in springboot". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.