Merge branch 'release/4.0.0'
Merge remote-tracking branch 'upstream/master' into develop
fixed with encoding and attachments, merged upstream patch