IntelliJ Java IDE
The moose likes Other JSE/JEE APIs and the fly likes sending email to yahoo via javamail ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "sending email to yahoo via javamail ?" Watch "sending email to yahoo via javamail ?" New topic
Author

sending email to yahoo via javamail ?

jhun kam
Greenhorn

Joined: Dec 05, 2001
Posts: 18
hi, i got a 'slight' problem in sending email to my own account at yahoo.com. here's the 'error' messages:
javax.mail.SendFailedException: Sending failed; nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 5.7.1 Unable to relay for jhun_kam@y
ahoo.com
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at SendEmail.main(SendEmail.java:47)
can anybody tell me the reason of this ? i'm sending my email through my own SMTP server at localhost.
Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
I think that "unable to relay" means that your local server does not recognize you as having an email account there. It thinks you are trying to send mail illegally. Try it with a from address that the local server knows.
Bill


Java Resources at www.wbrogden.com
jhun kam
Greenhorn

Joined: Dec 05, 2001
Posts: 18
Ahhh, thank you very much, i got my problem solved now. The problem was that i didnt activate relaying ability from my SMTP server.
Now a new problem arise, it's quit amusing. I was able to deliver emails to my account at elus1v3@hotmail.com, but unable to deliver emails to my jhun_kam@yahoo.com. The code is the same. I only make a change in the recipient name(elus1v3@hotmail.com into jhun_kam@yahoo.com). The program exits gracefully, no error nor warnings, but none of the messages arrived at my yahoo account. Any ideas, please ?
Les Dsouza
Greenhorn

Joined: Jan 29, 2002
Posts: 27
Hi,
1. From account should be a valid account on the yahoo server.
2. Yahoo mail server requires authentication, so set the property "mail.smtp.auth" to true.
3. To get debugging info call setDebug(true) on session object.
Hope this helps.
Jhun Hoon
Greenhorn

Joined: Nov 19, 2001
Posts: 28
Hi again, thanks for the help. I think i've found the culprit of my problem. It seems that if i want to send to yahoo mail, i must have a valid/registered domain in the internet. Setting the 'From' field to a hostname that is not registered in the internet will not be accepted by yahoo mail. (Strangely, hotmail will accept without further checking
Thanks for the help, ranchers.
 
 
subject: sending email to yahoo via javamail ?
 
Threads others viewed
Javax Mail API Question
JavaMail: Problem send mail to other host
Java Mail problem
Unable to connect using JavaMail
Relay Access denied /fully-qualified hostname
IntelliJ Java IDE