I am tired of using Javamail to send email. But I got the following message
javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Illegal Arguments (java.lang.IllegalArgumentException: Bad Request: ))
I tried to send an email from the administrator (the account I’m downloading), or the user I’m logging into the application. (off UserService - getCurrentUser().getEmail()) Both refused
I wonder if there is any special setting I have to set
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
UserService userService = UserServiceFactory.getUserService();
String email = userService.getCurrentUser().getEmail();
msg.setFrom(new InternetAddress(email));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress("some_test_email@gmail.com"));
msg.setSubject("Test Email");
msg.setText("Nobody");
Transport.send(msg);
Advise thanks Roy
source
share