Mojo::Sendgrid - Sendgrid API implementation for the Mojolicious framework
0.05
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;
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.
Mojo::Sendgrid inherits all events from Mojo::EventEmitter and can emit the following new ones.
See <Mojo::Sendgrid::Mail> for full list
Holds the configuration hash.
Accesses the apikey element of "config". Can be overridden by the environment variable SENDGRID_APIKEY. This attribute is required to have a value.
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.
$self = $self->mail(%args);
The mail endpoint of the Sendgrid Web API v2.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
Stefan Adams - sadams@cpan.org
sadams@cpan.org
To install Mojo::Sendgrid, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Sendgrid
CPAN shell
perl -MCPAN -e shell install Mojo::Sendgrid
For more information on module installation, please visit the detailed CPAN module installation guide.