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.