Sending an Email Using Java
- by user217029
try{
Properties props = new Properties();
props.put("mail.smtp.host", "ipc-smtp.bits-pilani.ac.in");
Session sess = Session.getInstance(props, null);
sess.setDebug(true);
Message msg = new MimeMessage(sess);
InternetAddress addressFrom = new InternetAddress("[email protected]");
msg.setFrom(addressFrom);
msg.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
msg.addHeader("MyHeaderName", "myHeaderValue");
msg.setSubject("Test");
msg.setContent("Yippe", "text/plain");
Transport.send(msg);
}catch(Exception exp){
exp.printStackTrace();
}
The error is javax.mail.MessagingException: 554 The mail was blocked due to zen-spamhaus RBL action
This is my college's smtp server.