Reputation: 359
I want to send mail from my application by using spring integration. I used MailSendingMessageHandler to send email which uses smtp protocol.
@Bean
public JavaMailSenderImpl mailSender() {
final JavaMailSenderImpl mailSenderImpl = new JavaMailSenderImpl();
mailSenderImpl.setHost(env.getProperty("integration.mail.host"));
mailSenderImpl.setPort(Integer.parseInt(env.getProperty("integration.mail.port")));
mailSenderImpl.setUsername(env.getProperty("integration.mail.username"));
mailSenderImpl.setPassword(env.getProperty("integration.mail.password"));
mailSenderImpl.setJavaMailProperties(additionalMailProperties());
mailSenderImpl.setProtocol(env.getProperty("integration.mail.protocol"));
return mailSenderImpl;
}
/**
* Mail sending message handler.
*
* @return the mail sending message handler
*/
@ServiceActivator(inputChannel = "sendEmailRequestChannel")
@Bean
public MailSendingMessageHandler mailSendingMessageHandler() {
final MailSendingMessageHandler handler = new MailSendingMessageHandler(mailSender);
handler.setLoggingEnabled(true);
return handler;
}
but i am not getting any response. i need to know whether the email has send successfully. i think MailSendingMessageHandler is an adapter. is there any gateway implementation , so that i'll geta mail sending status as a reply?
Upvotes: 0
Views: 238
Reputation: 174699
No; if no exception was thrown, then the send was successful.
A failure will cause an exception to be thrown.
Upvotes: 1