@ivan
I've done it with this significant difference: I'm using smtp with email and password plaintext written in code to send previously encrypted (with gnupg) message, I'm authenticating with TLS with external provider (e.g GMail). I'll edit code soon and will send you link