NAME
Mail::SendGrid::SmtpApiHeader - generate SendGrid's SMTP extension header
SYNOPSIS
use Mail::SendGrid::SmtpApiHeader;
# Use AnyEvent as usual
my $cond = AnyEvent->condvar;
http_get "http://search.cpan.org/", sub { $cond->send(); };
$cond->recv();
DESCRIPTION
This module generates the custom SMTP extension header used to configure SendGrid's SMTP platform.
METHODS
new
Used to create a new instance. The constructor takes no arguments.
my $headers = Mail::SendGrid::SmtpApiHeader->new();
addTo
Adds the given email address to the list of recipients (i.e. To).
$headers->addTo(
'me@example.com',
'you@example.com',
);
addSubVal
Specify substitution variables for multi recipient e-mails. This would allow you to, for example, substitute the string with a recipient's name. 'val' can be either a scalar or an array. It is the user's responsibility to ensure that there are an equal number of substitution values as there are recipients.
$headers->addSubVal(names => "Me", "You");
setUniqueArgs
Specify any unique argument values.
$headers->setUniqueArgs(
{
test => 1,
foo => 2,
}
);
setCategory
Sets a category for an e-mail to be logged as. You may use any category name you like.
$header->setCategory('send-001');
addFilterSetting
Adds/changes a setting for a filter. Settings specified in the header will override configured settings.
# Enable a text footer and set it
$header->addFilterSetting(footer =>
'enable', 1,
'text/plain', "Thank you for your business",
);
addUniqueArgs
Add unique argument values to the existing unique arguments.
$headers->addUniqueArgs(
test => 1,
foo => 2,
);
as_string
Returns the full header which can be inserted into an e-mail.
asJSON
Returns the JSON version of the requested data.
asJSONPretty
Returns the JSON version of the requested data in a more human readable way.
AUTHOR
SendGrid
Booking.com
Emmanuel Rodriguez <potyl@cpan.org>
COPYRIGHT
Copyright (C) 2010 by SendGrid
Copyright (C) 2011 by Booking.com
Copyright (C) 2012 by Emmanuel Rodriguez