Resolved Issue #348

Please note that I had not tested the code against the testcases provided in the tests/test_mail.py.
Here, I had just provided with the solution which can resolve the issue #348.

After the review for the solution, I will rewrite the code with the tests passed to merge with the source code.