When I set a name for multiple to element I got first elements name for other element. for example: <mail mailhost="smtp.gmail.com" user="sender@gmail.com" password="pass" ssl="true" mailport="465" subject="Test Gmail" charset="utf-8"> <from name="Sender" address="sender@gmail.com"/> <to name="receiver 1" address="receiver-1@yahoo.com"/> <to name="receiver 2" address="receiver-2@outlook.com"/> <header name="header name" value="header value"/> <message>The nightly build has completed</message> </mail> I got (To: receiver 1) for receiver-2@outlook.com in mail name.
Hello babakarya09, Would it be possible to attach us the "raw" mail content that you received?
If possible, please also attach the verbose logs from your ant build, which you can do by passing ant the "-v" option when you launch it.
I've just tried you setup with the Apache mailserver (using STARTTLS rather than ssl directly) with two recipients and it worked. So I doubt this is a bug within Ant o JavaMail and rather a problem with your GMail setup.