Fix sending empty and duplicated headers, FS#2887

This fixes sending empty and duplicated To/Cc/Bcc, Subject and From
headers in the additional headers. The To-header in the additional
headers prevented mail sending on some systems.
Merge pull request #461 from splitbrain/mail_headers

Fix sending empty and duplicated headers, FS#2887