Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaMail authentication

Status
Not open for further replies.

samit700

Programmer
Sep 23, 2003
52
US
Hi,

I am trying to use JavaMail to enable sending and receiving mails from my application. First of all I am not able to understand the basics of JAF (Javabeans Activation Framework) and why do we need it for JavaMail. Could someone please leave a line or two on this. Another thing I could not understand is java.mail.Session class. A session just contains some connection properties. What do they mean when they say a shared session which can be shared by other desktop applications also? I believe Transport is the real class that is doing the work of connecting and sending messages.

Now I am using the following code to send my mail. But although I am providing authentication, I get a 530 authentication required error on the console. Here is a small section of the code:
Transport tr = session.getTransport("smtp");
tr.connect(mxServer, mxUsername, mxPassword);
msg.saveChanges();
tr.sendMessage(msg, msg.getAllRecipients()); //--error line
tr.close();

I get a 530 error on the error line. I have set the appropriate message fields. I am using "smtp.mail.yahoo.com" as the smtp host with my authentication.

Could someone please answer my questions? Thanks in advance.

Samit
 
Hi,

I got the problem. I was using the wrong smtp host name. I did a nslookup and it gave the right mail host name. Thanks anyways for your help.

P.S. Sedj thanks for the tutorial link.

Samit
 
Hi, I've got the same problem (using Yahoo, too).
What address did you use? I tried smtp.mail.vip.ukl.yahoo.com (I use yahoo.co.uk)?

Can there be any other problem?

nestor
 
try "mx1.mail.yahoo.com" as yahoo smtp server
 
Its actually either :
mx2.mail.ukl.yahoo.com
or
mx1.mail.ukl.yahoo.com

You can find out the MX records for relays by doing :

nslookup -type=mx domain.com

So :

Code:
C:\Documents and Settings\xxx.001>nslookup -type=mx yahoo.co.uk
Server:  xxx.xxx.xxx.xxx
Address:  192.168.2.231

Non-authoritative answer:
yahoo.co.uk     MX preference = 20, mail exchanger = mx2.mail.ukl.yahoo.com
yahoo.co.uk     MX preference = 10, mail exchanger = mx1.mail.ukl.yahoo.com

yahoo.co.uk     nameserver = ns5.yahoo.com
yahoo.co.uk     nameserver = ns1.yahoo.com
yahoo.co.uk     nameserver = ns3.yahoo.com
yahoo.co.uk     nameserver = ns4.yahoo.com

C:\Documents and Settings\xxx.001>

--------------------------------------------------
Free Database Connection Pooling Software
 
It still doesn work. I've been told that many SMTP servers actually do POP request first to fight spam.
Did anyone try to open POP session before SMTP? How is it possible to have the two open at the same time?

N
 
I can send mail to mx1.mail.ukl.yahoo.com no problem.

I would say the error is either in your code, or that your firewall is blocking outgoing traffic to port 25. If you cannot telnet successfully to mx1.mail.ukl.yahoo.com on port 25, then its your firewall. Eg :

telnet mx1.mail.ukl.yahoo.com 25

--------------------------------------------------
Free Database Connection Pooling Software
 
You're right- it's firewall. I cant't telnet it. Will try it at home later today. Thanks a lot. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top