Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marcusramberg/mojolicious-plugin-mailgun


https://github.com/marcusramberg/mojolicious-plugin-mailgun

Last synced: 17 days ago
JSON representation

Awesome Lists containing this project

README

        

NAME
Mojolicious::Plugin::Mailgun - Easy Email sending with mailgun

SYNOPSIS
# Mojolicious::Lite
plugin 'mailgun' => { mom => {
api_key => '123',
domain => 'mom.no',
}};

# Mojolicious
$self->plugin(mailgun => { mom => {
site => {
api_key => '123',
domain => 'mom.no',
}});

# in controller named params
$self->mailgun->send( mom => {
recipient => '[email protected]',
subject => 'use Perl or die;'
html => $html,
inline => { file => 'public/file.png' },
sub { my $self,$res = shift }, # receives a Mojo::Transaction from mailgun.
);

DESCRIPTION
Provides a quick and easy way to send email using the Mailgun API with
support for multiple user agents.

OPTIONS
Mojolicious::Plugin::Mailgun can be provided a hash of mailgun sites
with "api_key" and "domain", or it can read them directly from
$c->config->{mailgun} if not provided at load time.

HELPERS
Mojolicious::Plugin::Mailgun implements one helper.

mailgun->send <$site>, <\%post_options>, <$cb>
Send a mail with the mailgun API. This is just a thin wrapper around
Mojo::UserAgent to handle authentication settings. See the mailgun
sending documentation for more information about the supported arguments
to the post_options hash. This API can only be used non-blocking, so the
callback is required.

METHODS
Mojolicious::Plugin::Mailgun inherits all methods from
Mojolicious::Plugin and implements the following new ones.

"register"
$plugin->register;

Register plugin hooks and helpers in Mojolicious application.

SEE ALSO
Mojolicious

AUTHOR
Marcus Ramberg

COPYRIGHT & LICENSE
Copyright (C) 2017 by Marcus Ramberg.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.