Giter Site home page Giter Site logo

springboot_mail's Introduction

SpringBoot_mail

SpringBoot发送邮件的示例-学习来自慕课网


主要实现以下几种发送形式

  1. 发送简单邮件
  2. 发送HTML邮件(个人感觉和简单邮件是差不多的,纯属个人观点)
  3. 发送带附件的邮件
  4. 发送静态图片(一张和多张)

  1. pom.xml中引入spring-boot-starter-mail
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-mail</artifactId>
	</dependency>
  1. application.properties文件中设置你的邮箱参数 关键参数4个,YourEmail、yourPass修改为自己的,yourPass可能不是直接网页版的登录密码,而是需要授权码 具体的请查看各大邮箱服务商的配置参数
spring.mail.host=smtp.qq.com
spring.mail.username=YourEmail
spring.mail.password=yourPass
spring.mali.default-encoding=UTF-8
  1. 在Service中使用自动装配
  @Autowired
	private JavaMailSender mailSender;
  1. 再调用各发送类型方法即可 具体请查看src\main\java\com\bigorang\service的内容

springboot_mail's People

Contributors

yourxin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.