Sending Mail
N
ow that you know how to read the mail in your Inbox
with your own programs, it’s time to move on to replying
to those mails by sending your own messages.
Sending Mail with Gmail SMTP
The first thing to remember is that Gmail provides its own SMTP
server. This offers two major features. First, you can use the SMTP
server from your own e-mail application, which is a great help if
you’re traveling and your usual e-mail provider is unreachable. The
second use is that every single scripting language you might have a
desire to use has standard SMTP support available as a library, and
the support for TLS encryption, which you need to connect to
Gmail, is being added apace.
First, though, the settings you’ll need:
Server name:smtp.google.com
Username:[email protected]
Password:Your Gmail password
Security:Yes, using TLS
One thing to note about this technique is that Gmail will rewrite
your e-mail headers. It replaces the From: and Reply-to: lines
with your Gmail address because Gmail also automatically adds
the so-called Domain Keys to their outgoing e-mails, allowing
spam-hit system administrators to block fake Gmail mail from
their servers. Without the Domain Keys this wouldn’t work, but
Gmail can’t send mail with a different From: or Reply-to: address
without breaking the Domain Key.
̨Using the Gmail
SMTP server
̨Sending mail
with Perl
̨Replying to
mail with Perl
chapter
in this chapter