Coder Social home page Coder Social logo

mailgun's Introduction

MailGun

A ColdBox Module for the MailGun API

This module is a fork of mjclemente/mailgun.cfc converted into a ColdBox Module.

This project borrows heavily from the API framework built by jcberquist with stripecfc.

Your account credentials can be found on the dashboard of your Mailgun account: https://mailgun.com/app/dashboard.

Mailgun API Keys

Currently both your Secret API Key and your Public API Key must be provided. The Secret API Key is used for most operations. In prior versions, email validation calls used the Public API Key. However, now that Mailgun has moved to a usage based pricing model for their email validation, the default for email validation calls is also to use the Secret API Key. The Public API Key requirement will likely be removed in later versions. It's currently included, so that calls can explicitly be made to the public endpoint of the email validation API.

Installation

box install mailgun

Getting Started

WireBox Injection

property name="mailGunService" inject="mailgun";

Configure Settings

Coldbox.cfc

Settings{
    MailGun = {
        secretApiKey = 'key-xxx', 
        publicApiKey = 'pubkey-xxx', 
        domain = 'yourdomain.com', 
        baseUrl = 'https://api.mailgun.net/v3' 
    }
};

Available Methods

Note that the Mailgun API has more methods available. This is a list of those currently available in this wrapper. I'll be adding more as time permits and needs dictate.

mailGunService.validate( 
    required string address, 
    boolean mailbox_verification = false, 
    boolean private = true 
    )
mailGunService.sendMessage( 
    string domain = variables.domain, 
    required string from, 
    required string to, 
    string cc, 
    string bcc, 
    string subject, 
    string text = "", 
    string html = "", 
    any attachment, 
    any inline, 
    struct o = { }, 
    struct h = { }, 
    struct v = { } 
    )

mailGunService.getStoredMessage( required string messageUrl )
mailGunService.getBounces( 
    string domain = variables.domain, 
    numeric limit = 100 
    )
mailGunService.getStats( 
        string domain = variables.domain, 
        required string event, 
        date start = '#now()#-7', 
        date end = '#now()#', 
        string resolution = 'day', 
        string duration
        )
mailGunService.getLists()

mailGunService.getList( 
        required string listaddress, 
        numeric limit = 100, 
        numeric skip = 0 
        )

mailGunService.createList( 
    required string address, 
    string name = "", 
    string description = "", 
    access_level = "readonly" 
    )

mailGunService.createListMember( 
    required string listaddress, 
    required string address, 
    string name, 
    string vars, 
    boolean subscribed = true, 
    boolean upsert = false 
    )

mailGunService.createListMembers( 
    required string listaddress, 
    required json members, 
    boolean upsert = false 
    )

mailgun's People

Contributors

mjclemente avatar mjhagen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.