• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Email send failure

 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have got this exception while trying to run my application which suppose to send email message:

javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 Authentication require
d. Help at http://www.earthlink.net/go/emailsettings (failed to find host name f
rom IP address)

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
at javax.mail.Transport.send0(Transport.java:169)
at javax.mail.Transport.send(Transport.java:98)
at Reminder.sendMessage(Reminder.java:41)
at Reminder.main(Reminder.java:92)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 Authentication requ
ired. Help at http://www.earthlink.net/go/emailsettings (failed to find host nam
e from IP address)

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)
... 5 more




my code is as follows:

[ April 03, 2007: Message edited by: A Yehia ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


550 Authentication required. Help at http://www.earthlink.net/go/emailsettings (failed to find host name from IP address)


This is your cause. You need authenticated to send mail.

Try the code below, instead of Transport.send()

[ April 03, 2007: Message edited by: Paul Sturrock ]
 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ve got this exception after reformating my code:

javax.mail.NoSuchProviderException: No provider for earthlink.net
at javax.mail.Session.getProvider(Session.java:455)
at javax.mail.Session.getTransport(Session.java:650)
at javax.mail.Session.getTransport(Session.java:631)
at Reminder.sendMessage(Reminder.java:42)
at Reminder.main(Reminder.java:99)


Code:

try {
String smtp = "earthlink.net";
Properties props = System.getProperties();
props.put("mail.smtp.host", smtp);
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom( new InternetAddress("me@hotmail.com"));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("emailadress@hotmail.com"));
message.setSubject("Subject");
message.setText("Body Text");
Transport t = session.getTransport(smtp);
try {
t.connect("username", "password");
t.sendMessage(message, message.getAllRecipients());
} catch (Exception e) { }
finally {
t.close();
}
} catch (Exception e){
e.printStackTrace();
}
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you click on the link in your previous error message, http://www.earthlink.net/go/emailsettings, you get a page that tells you how to configure various email clients to use Earthlink SMTP, including the correct name for the SMTP server.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

String smtp = "earthlink.net";
Properties props = System.getProperties();
props.put("mail.smtp.host", smtp);



You need to provide the mail server, which might be something like smtp.earthlink.net or mail.earthlink.net or some such. Consult the Earthlink documentation or online help to find what you need to put in there.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Before using your SMTP address try to ping that from command prompt if it's valid you will get reply from ping commnad.
CMD:>ping mail.yahoo.com

Thanks!
 
pie. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic