I am trying to send an e-mail using JavaMail API. But the thing is I can send it to my own Mail ID. But when I try my friends e-mail id i get an error message. I am putting his SMTP address and his e-mail address but i get an error message.
An SMTP 550 message is caused by server configuation - someone has deliberately configured a server to prevent relaying messages from domains not supported by the server. If this is a server you administer you should be able to fix it.
The problem here is more than likely to be authentication related. To send to an external email address you often need to authenticate your request.
When I hit similar problems a while ago, the way I authenticated (there may be other ways) was to add a property to the request.
You probably have something like:
Properties prop = new Properties();
For authentication you also need to add:
Then when you use the Transport to send the message use the method:
Transport trans = session.getTransport(transportType);
Another option for my org was to configure the email server to allow relay without authentication from selected hosts. Thats a question for your server admins.