Why don't you use an established module like MIME::Lite, or find out how MIME::Lite does sending via Gmail?
Personally, I would try the approach outlined in Re^2: Mime::Lite and SMTP authentication?.
In reply to Re: help on socket to smtp on TLS/SSL
by Corion
in thread help on socket to smtp on TLS/SSL
by beanscake
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |