Fix duplicate emails when using CC

[Fixes #4]
Add missing dependency

[ci skip]
Be IPv6 friendly
Refactor large method
Add PID to log file