Email-Sender-Transport-Mailgun
view release on metacpan or search on metacpan
lib/Email/Sender/Transport/Mailgun.pm view on Meta::CPAN
my $self = shift;
my ($proto, $rest) = split('://', $self->base_uri);
my $domain = $self->domain;
# Percent-escape anything other than alphanumeric and - _ . ~
# https://github.com/sdt/Email-Sender-Transport-Mailgun/issues/4
my $api_key = $self->api_key;
$api_key =~ s/[^-_.~0-9a-zA-Z]/sprintf('%%%02x',ord($&))/eg;
# adapt endpoint based on region setting.
$rest =~ s/(\.mailgun)/sprintf('.%s%s', $self->region, $1)/e
if defined $self->region && $self->region ne 'us';
return "$proto://api:$api_key\@$rest/$domain";
}
no Moo;
1;
__END__
( run in 0.308 second using v1.01-cache-2.11-cpan-beeb90c9504 )