I am facing a strange problem when I am running my java mail code from eclipse it is being sent as an inline message but when same java code is being executed from an ant script than it is being sent as an attachment I have shared the code for sending java mail below, Please help me with this.
Look at the headers of the two mail messages which are different. You should find evidence that they were sent by JavaMail and you might find more interesting evidence. At any rate it's probable that the difference is caused by some configuration difference between the two systems. For code it's easy to say "Post your code" but for configuration we can't say "Post your configuration" because that could be all sorts of things. You could also modify your code so that it inserts the JavaMail version number into the message.