![JAR search and dependency download from the Maven repository](/logo.png)
io.github.ilyalisov.mail.config.vendors.MailRuMailSender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-mail Show documentation
Show all versions of spring-boot-starter-mail Show documentation
Mail service for Spring Boot applications.
package io.github.ilyalisov.mail.config.vendors;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import java.util.Properties;
public class MailRuMailSender extends JavaMailSenderImpl {
/**
* Default host of Mail.ru mail server.
*/
private static final String HOST = "smtp.mail.ru";
/**
* Creates and object.
*
* @param username username of mail account
* @param password password of mail account. Often a token for apps
*/
public MailRuMailSender(
final String username,
final String password
) {
Properties props = new Properties();
props.put("mail.debug", false);
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", true);
props.put("mail.smtp.host", HOST);
props.put("mail.smtp.ssl.protocols", "TLSv1.2");
props.put("mail.smtp.ssl.enable", true);
props.put("mail.smtp.ssl.trust", HOST);
props.put("mail.smtp.starttls.enable", false);
this.setHost(HOST);
this.setPort(465);
this.setUsername(username);
this.setPassword(password);
this.setJavaMailProperties(props);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy