The wiki example shows an example of sending mail on port 25, but Google SMTP Server requires tls over port 465. Can someone show an example using tls?
The easiest way is to use the SendMail
function. From the docs:
SendMail connects to the server at addr, switches to TLS if possible, authenticates with the optional mechanism a if possible, and then sends an email from address from, to addresses to, with message msg. The addr must include a port, as in "mail.example.com:smtp".