NAME
Email::Send::Gmail - Send Messages using Gmail
SYNOPSIS
#!/usr/bin/perl
use strict;
use warnings;
use Email::Send;
use Email::Send::Gmail;
use Email::Simple::Creator;
my $email = Email::Simple->create(
header => [
From => 'magic_monitoring@gmail.com',
To => 'acme@astray.com',
Subject => 'Server down',
],
body => 'The server is down. Start panicing.',
);
my $sender = Email::Send->new(
{ mailer => 'Gmail',
mailer_args => [
username => 'magic_monitoring@gmail.com',
password => 'XXX',
]
}
);
eval { $sender->send($email) };
die "Error sending email: $@" if $@;
DESCRIPTION
Gmail is a free Web-based email service provided by Google. This module is a mailer for Email::Send
that sends a message using Gmail's authenticated SSL SMTP service. You must have a Gmail account and you should send emails 'From' that account.
You should pass in the username and password for the Gmail account. Sending emails can fail for many reasons and this module croaks upon any errors.
ENVELOPE GENERATION
The envelope sender and recipients are, by default, generated by looking at the From, To, Cc, and Bcc headers. This behavior can be modified by replacing the get_env_sender
and get_env_recipients
methods, both of which receive the Email::Simple object and their only parameter, and return email addresses.