我是 Spring 新手,在使用 Spring Boot 邮件发送邮件时遇到一些问题。我正在 application.properties 文件中定义用户、密码和其他所有内容,但 spring 尝试使用我的电脑用户名 (usuario@usuario-Inspiron-3647) 发送电子邮件。
应用程序属性
#spring boot properties
#Mon Oct 02 08:41:37 EDT 2017
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.datasource.url=jdbc\:postgresql\://localhost/database
spring.jpa.hibernate.ddl-auto=validate
#Spring Mail Config
spring.mail.host = email-ssl.com.br
spring.mail.port = 587
spring.mail.username = teste@teste.com
spring.mail.password = teste
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.starttls.enable = true
Run Code Online (Sandbox Code Playgroud)
电子邮件服务实现
@Component
public class EmailServiceImpl implements EmailService {
@Autowired
public JavaMailSender emailSender;
@Override
public boolean sendSimpleMessage(String to, String subject, String text, String cc, String bcc) {
try {
SimpleMailMessage message = new …Run Code Online (Sandbox Code Playgroud) 我是新手,我正在尝试构建一个相当简单的应用程序。我有这个简单的代码(仍在进行中),我试图在用户每次单击按钮时添加一个新的小部件。
这是我的代码:
class ResponsavelProfilePage extends StatefulWidget {
@override
_ResponsavelProfilePageState createState() => new _ResponsavelProfilePageState();
}
class _ResponsavelProfilePageState extends State<ResponsavelProfilePage> {
int _count = 1;
@override
Widget build(BuildContext context) {
List<Widget> _contatos = new List.generate(_count, (int i) => new ContactRow());
return new Scaffold(
appBar: new AppBar(
title: new Text(GlobalConstants.appName),
),
body: new LayoutBuilder(builder: (context, constraint) {
final _maxHeight = constraint.biggest.height / 3;
final _biggerFont = TextStyle(fontSize: _maxHeight / 6);
return new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new TextFormField(
decoration: …Run Code Online (Sandbox Code Playgroud)