how to send mail Spring implemention using gmail smtp?
After executing main method getting exeception Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/FileTypeMap
public static void main(String[] args) {
JavaMailSenderImpl sender = new JavaMailSenderImpl();
sender.setHost("smtp.gmail.com");
sender.setPort(25);
sender.setPassword("xxxxxxx");
sender.setUsername("[email protected]");
MimeMessage message = sender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message);
helper.setTo("[email protected]");
helper.setText("Thank you for ordering!");
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sender.send(message);
}
After putting activation.jar in class path getting this exception
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. 21sm3277189pzk.7