• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JMS - SendFailedException: 554 - Access denied ?!

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi people,
The following is a piece of code, my first try on JavaMail API....
public class SendMail {
public static void main(String[] args) {
try {
String host = "smtp.vsnl.com";
String from = "[email protected]";
String to = "[email protected]";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
// Send message
System.out.println("Sending the message.......");
Transport.send(message);
System.out.println("Message sent..............");
}catch(Exception ex){
ex.printStackTrace();
}
}
}
The output -
Sending the message.......
Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 554 <[email protected]>: Sender address rejected: Access denied
The mail ids here are valid and infact I also tried some other non-yahoo / hotmail ids, but it still does not work !!!
Any fixes to be done to the code ??
Regards.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i faced the same problem, but it worked if i give the "sender mail id server", means, if you are using yahoo mail id, try to give the yahoo server (may be pop3) name as host. then it will work.
i tried with my company server.
 
There's a city wid manhunt for this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic