Email-SendGrid-V3
view release on metacpan or search on metacpan
lib/Email/SendGrid/V3.pm view on Meta::CPAN
#pod
#pod =cut
sub send {
my ($self, %args) = @_;
my $api_key = $args{api_key} || $self->{api_key} or croak "API key is required to send";
my $endpoint = $args{endpoint} || $self->{endpoint} || DEFAULT_ENDPOINT;
my $payload = $self->_payload;
my $http = HTTP::Tiny->new(
keep_alive => 0,
default_headers => {
'Content-Type' => 'application/json',
'Authorization' => "Bearer $api_key",
},
);
my $response = $http->post(
$endpoint, { content => $payload },
);
( run in 0.621 second using v1.01-cache-2.11-cpan-39bf76dae61 )