Iain: The error that I'm getting is that pool.execute(new sendMail(msg)); is empty but the msg is being created.
I am not sure I am following this statement.
What do you intend by "pool.execute(new sendMail(msg)); is empty"?
Is it so that you do not add any tasks to the executor but still it is getting executed?
I strongly believe that such a thing is not possible. Either some other part of your program is sending an e-mail that you do not expect or there is some confusion over the emptiness of the executor.
BTW, I do not see a code that initializes the executor. Is that something you are missing.
Also, If you are getting an error please post the same.