Skip to content

orkonano/grails-mailgun

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status Project Status Stories in Ready

grails-mailgun

Grails plugin to use Mailgun Api.

¡IMPORTANT! You need to create your own mailgun account. The plugin doesn't work without a valid api-key and a valid domain

Config parameters

You need to set into your Config.groovy the following properties:

mailgun{
       apiKey = 'test'
       domain = 'test'

       message{
              defaultFrom = 'test'
              defaultTo = 'test'
              defaultSubject = 'BigHamlet tiene promociones para vos'
              format = 'html'
              defaulTemplate = '/test/mailgunTest'
              defaultReplyTo = 'test'
       }
}

The full list of properties is:

mailgun{
       apiKey = 'test'
       domain = 'test'

       message{
              defaultFrom = 'test'
              defaultTo = 'test'
              defaultSubject = 'BigHamlet tiene promociones para vos'
              format = 'html'
              defaulTemplate = '/test/mailgunTest'
              defaultReplyTo = 'test'
       }

       tracking{
              enabled = 'yes'
              clicks{
                     enabled = 'yes'
              }
              opens{
                     enabled = 'yes'
              }
       }
}

Mailgun Features

The plugin allows to work with some features of mailgun:

Email Html Render

The plugin define a default email html render. DefaultEmailHtmlRender.groovy It render a view (gsp) passing a model as params

    String render(Map params){
        groovyPageRenderer.render view: params.view, model: params.model
    }
    

Examples

 class TestController {

    def mailgunService

    def index() {
        RestResponse resp = mailgunService.allLists

        render resp.json.items
    }

    def send() {
        RestResponse resp = mailgunService.sendMessage()

        render resp.status
    }
}

Examples

 class TestController {

    def mailgunService

    def index() {
        RestResponse resp = mailgunService.allLists

        render resp.json.items
    }

    def send() {
        RestResponse resp = mailgunService.sendMessage()

        render resp.status
    }
}

MailgunService implements all features.

The method allLists, lists all mail lists created in mailgun.

The method sendMessage, sends a new message across mailgun api.

About

Grails plugin to use Mailgun Api

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •