Hello All,
I know that if any of the email addresses is invalid, SendFailedException is thrown by the JavaMail system. Where as this is not happening in my case. Even if I give addresses like abc@xyz.com, asdf@asdf.com, no exception is being generated. Do I need to set any property explicitly or any thing else. I am posting the code below.
Properties props = new Properties();
props.put("mail.smtp.host", "202.153.44.9");
props.put("mail.smtp.sendpartial", "true");
Session sess = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(sess);
msg.setFrom(new InternetAddress("myEmailId")); // in code I have given a correct email id here.
InternetAddress[] toAddresses = {new InternetAddress("abc@xyz.com")};
msg.setRecipients(Message.RecipientType.TO, toAddresses);
InternetAddress[] replyAddr = {new InternetAddress("issaque_md@hotmail.com")};
msg.setSubject("Bad address testing");
msg.setSentDate(new Date());
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText("This is a test mail\nsent using Java Mail");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
msg.setContent(mp);
Transport.send(msg);
Any help would be very kindful and will be greatly appreciated.
Thanks and best wishes