use of org.springframework.mail.javamail.JavaMailSenderImpl in project kylo by Teradata.
the class TestConfiguration method javaMailSender.
@Bean(name = "slaEmailSender")
public JavaMailSender javaMailSender(@Qualifier("slaEmailConfiguration") EmailConfiguration emailConfiguration) {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
Properties mailProperties = new Properties();
mailProperties.put("mail.smtp.auth", emailConfiguration.getSmtpAuth());
mailProperties.put("mail.smtp.starttls.enable", emailConfiguration.getStarttls());
if (StringUtils.isNotBlank(emailConfiguration.getSmptAuthNtmlDomain())) {
mailProperties.put("mail.smtp.auth.ntlm.domain", emailConfiguration.getSmptAuthNtmlDomain());
}
mailProperties.put("mail.debug", "true");
mailSender.setJavaMailProperties(mailProperties);
mailSender.setHost(emailConfiguration.getHost());
mailSender.setPort(emailConfiguration.getPort());
mailSender.setProtocol(emailConfiguration.getProtocol());
mailSender.setUsername(emailConfiguration.getUsername());
mailSender.setPassword(emailConfiguration.getPassword());
return mailSender;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project oc-explorer by devgateway.
the class EmailServiceConfiguration method javaMailSenderImpl.
@Bean
public JavaMailSenderImpl javaMailSenderImpl() {
JavaMailSenderImpl jmsi = new JavaMailSenderImpl();
jmsi.setHost("localhost");
jmsi.setPort(SMTP_PORT);
return jmsi;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project waltz by khartec.
the class DIConfiguration method mailSender.
@Bean
public JavaMailSender mailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(smtpHost);
mailSender.setPort(smtpPort);
return mailSender;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project perun by CESNET.
the class Utils method sendPasswordResetEmail.
/**
* Sends email with link to non-authz password reset GUI where user
* can reset forgotten password
*
* @param user user to send notification for
* @param email user's email to send notification to
* @param namespace namespace to reset password in
* @param url base URL of Perun instance
* @param id ID of pwd reset request
* @throws InternalErrorException
*/
public static void sendPasswordResetEmail(User user, String email, String namespace, String url, int id) throws InternalErrorException {
// create mail sender
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("localhost");
// create message
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(email);
message.setFrom(BeansUtils.getCoreConfig().getMailchangeBackupFrom());
String instanceName = BeansUtils.getCoreConfig().getInstanceName();
message.setSubject("[" + instanceName + "] Password reset in namespace: " + namespace);
// get validation link params
String i = cipherInput(String.valueOf(user.getId()), false);
String m = cipherInput(String.valueOf(id), false);
try {
URL urlObject = new URL(url);
StringBuilder link = new StringBuilder();
link.append(urlObject.getProtocol());
link.append("://");
link.append(urlObject.getHost());
// reset link uses non-authz
link.append("/non/pwd-reset/");
link.append("?i=");
link.append(URLEncoder.encode(i, "UTF-8"));
link.append("&m=");
link.append(URLEncoder.encode(m, "UTF-8"));
// Build message
String text = "Dear " + user.getDisplayName() + ",\n\nWe've received request to reset your password in namespace \"" + namespace + "\"." + "\n\nPlease visit the link below, where you can set new password:\n\n" + link + "\n\n" + "Message is automatically generated." + "\n----------------------------------------------------------------" + "\nPerun - Identity & Access Management System";
message.setText(text);
mailSender.send(message);
} catch (UnsupportedEncodingException ex) {
throw new InternalErrorException("Unable to encode URL for password reset.", ex);
} catch (MalformedURLException ex) {
throw new InternalErrorException("Not valid URL of running Perun instance.", ex);
}
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project gravitee-management-rest-api by gravitee-io.
the class EmailConfiguration method mailSender.
@Bean
public JavaMailSenderImpl mailSender() {
final JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setHost(host);
if (StringUtils.isNumeric(port)) {
javaMailSender.setPort(Integer.valueOf(this.port));
}
javaMailSender.setUsername(username);
javaMailSender.setPassword(password);
javaMailSender.setProtocol(protocol);
javaMailSender.setJavaMailProperties(loadProperties());
return javaMailSender;
}
Aggregations