NAME
Mojo::Sendgrid - Sendgrid API implementation for the Mojolicious framework
VERSION
0.05
SYNOPSIS
use Mojo::Sendgrid;
my $sendgrid = Mojo::Sendgrid->new(
config => {
apikey => 'get your key from api.sendgrid.com',
#apiurl => 'you do not need to set this',
},
);
$sendgrid->on(mail_send => sub {
my ($sendgrid, $ua, $tx) = @_;
say $tx->res->body;
});
say $sendgrid->mail(
to => q(a@b.com),
from => q(x@y.com),
subject => time,
text => time
)->send;
Mojo::IOLoop->start;
DESCRIPTION
Mojo::Sendgrid is an implementation of the Sendgrid API and is non-blocking thanks to Mojo::IOLoop from the wonderful Mojolicious framework.
It currently implements the mail endpoint of the Web API v2.
This class inherits from Mojo::EventEmitter.
EVENTS
Mojo::Sendgrid inherits all events from Mojo::EventEmitter and can emit the following new ones.
mail_*
See <Mojo::Sendgrid::Mail> for full list
ATTRIBUTES
config
Holds the configuration hash.
apikey
Accesses the apikey element of "config". Can be overridden by the environment variable SENDGRID_APIKEY. This attribute is required to have a value.
apiurl
Accesses the apiurl element of "config". Can be overridden by the environment variable SENDGRID_APIURL. This attribute by default uses the Web API v2 URL documented by Sendgrid.
METHODS
$self = $self->mail(%args);
The mail endpoint of the Sendgrid Web API v2.
COPYRIGHT
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
AUTHOR
Stefan Adams - sadams@cpan.org