Если указывать так, то работать почта будет:
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom("no-reply@example.com");
А если указать через такие параметры, то работать не будет:
spring.mail.properties.mail.smtp.from=no-reply@example.com
spring.mail.from.email=no-reply@example.com
spring.mail.from=no-reply@example.com
Как сделать, чтобы работало? Не хочется во всех местах кода указывать одинаковый message.setFrom("no-reply@example.com");
Ошибку такую выдает gmail, если использовать application.properties:
Our system has detected that this message is 550-5.7.1 not RFC 5322 compliant: 550-5.7.1 'From' header is missing. 550-5.7.1 To reduce the amount of spam sent to Gmail, this message has been 550-5.7.1 blocked.