Mail::SendGrid - interface to SendGrid.com mail gateway APIs
version 0.07
use Mail::SendGrid; $sendgrid = Mail::SendGrid->new('api_user' => '...', 'api_key' => '...'); print "Email to the following addresses bounced:\n"; foreach my $bounce ($sendgrid->bounces) { print "\t", $bounce->email, "\n"; } $sendgrid->delete_bounces(email => 'neilb@cpan.org');
This module provides easy access to the APIs provided by sendgrid.com, a service for sending emails. At the moment the module just provides the bounces() and delete_bounces() methods. Over time I'll add more of the SendGrid API.
bounces()
delete_bounces()
Takes two parameters, api_user and api_key, which were specified when you registered your account with SendGrid. These are required.
This requests bounces from SendGrid, and returns a list of Mail::SendGrid::Bounce objects. By default it will pull back all bounces, but you can use the following parameters to constrain which bounces are returned:
Number of days in the past for which to return bounces. Today counts as the first day.
The start of the date range for which to retrieve bounces. The date must be in ISO 8601 date format.
The end of the date range for which to retrieve bounces. The date must be in ISO 8601 date format.
The maximum number of bounces that should be returned.
An offset into the list of bounces.
Limit the returns to either hard or soft bounces. A soft bounce is one which would have a 4xx SMTP status code, a persistent transient failure. A hard bounce is one which would have a 5xx SMTP status code, or a permanent failure.
Only return bounces for the specified email address.
For example, to get a list of all soft bounces over the last week, you would use:
@bounces = $sendgrid->bounces(type => 'soft', days => 7);
This is used to delete one or more bounces, or even all bounces; the following options constrain which bounces are deleted. For a description of the options, see "bounces".
start_date
end_date
type
email
To delete all bounces, call this without any options:
$sendgrid->delete_bounces();
The class which defines the data objects returned by the bounces method.
http://sendgrid.com/docs/API%20Reference/Web%20API/bounces.html
Neil Bowers <neilb@cpan.org>
This software is copyright (c) 2012 by Neil Bowers <neilb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mail::SendGrid, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::SendGrid
CPAN shell
perl -MCPAN -e shell install Mail::SendGrid
For more information on module installation, please visit the detailed CPAN module installation guide.