const classmailgun::Mailgun
sys::Obj mailgun::Mailgun
Mailgun API
- addBounce
Str:Obj addBounce(Str address, Int? errCode := null, Str? errMsg := null)
Adds a permanent bounce to bounce table. Updates existing recored if already there. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for bounces:
- addComplaint
Str:Obj addComplaint(Str address)
Adds an address to complaints table. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for complaints:
- addUnsubscribe
Str:Obj addUnsubscribe(Str address, Str tag := "*")
Add address to unsubscribe table. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for unsubscribes:
- bounces
Str:Obj[] bounces(Int? limit := null, Int? skip := null)
Get list of bounces.
- limit: Max number of records to return, or null for Mailgun default
- skip: Number of records to skip, or null for Mailgun default
See Mailgun documentation for bounces:
- complaints
Str:Obj[] complaints(Int? limit := null, Int? skip := null)
Get list of spam complaints.
- limit: Max number of records to return, or null for Mailgun default
- skip: Number of records to skip, or null for Mailgun default
See Mailgun documentation for complaints:
- domain
const Str domain
Domain to use for your Mailgun account.
- events
Str:Obj[] events([Str:Str]? filters := null, Obj? begin := null, Obj? end := null, Int? limit := null)
Get events for this Mailgun account.
- filters: The set of filters to apply for retrieving events, or null for Mailgun default.
- begin: a
Date
orDateTime
to start the filter from, or null for Mailgun default. - end: a
Date
orDateTime
to filter up to, or null for Mailgun default. - limit: Max number of items to return, or null for Mailgun default.
See Mailgun documentation for events:
- from
const Str? from
- getBounce
Str:Obj getBounce(Str address)
Get a single bounce event by email address. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for bounces:
- getComplaint
Str:Obj getComplaint(Str address)
Get a single spam complaint by email address. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for complaints:
- getUnsubscribe
Str:Obj[] getUnsubscribe(Str address)
Get a single unsubscribe record. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for unsubscribes:
- invoke
Obj invoke(Str method, Uri endpoint, [Str:Obj]? params := null)
Invoke a REST API with given arguments. If method is "GET" params sent in query string, otherse as request body.
invoke("GET", `/log`, ["limit":"25"])
API calls that return a list of items will include paging information in the first and last item. You can pass those items to the various paging methods to retrieve more items.
- isValidAddress
Bool isValidAddress(Str address)
Convenience to determine if an email address is valid or not
- log
@
Deprecated { msg="Use the events api instead" }
Str:Obj[] log(Int? limit := null, Int? skip := null)Get log entries for this Mailgun account.
- limit: Max number of records to return, or null for Mailgun default
- skip: Number of records to skip, or null for Mailgun default
See Mailgun documentation for log:
- make
new make(|This? f := null)
Constructor.
- pageFirst
Str:Obj[] pageFirst(Str:Obj item)
Get the first page items. See invoke for details.
- pageLast
Str:Obj[] pageLast(Str:Obj item)
Get the last page items. See invoke for details.
- pageNext
Str:Obj[] pageNext(Str:Obj item)
Get the next page of items. See invoke for details.
- pagePrev
Str:Obj[] pagePrev(Str:Obj item)
Get the previous page of items. See invoke for details.
- privApiKey
const Str privApiKey
Private API key for your Mailgun account.
- pubApiKey
const Str? pubApiKey
Public API key for your Mailgun account.
- removeBounce
Str:Obj removeBounce(Str addressOrId)
Remove a bounce event. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for bounces:
- removeComplaint
Str:Obj removeComplaint(Str addressOrId)
Remove a given spam complaint. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for complaints:
- removeTag
Deletes all counters for given tag. Returns response from Mailgun. Throws Err if fails for any reason.
See Mailgun documentation for stats:
- removeUnsubscribe
Str:Obj removeUnsubscribe(Str addressOrId)
Remove an address from unsubscribe table. Returns response from Mailgun if successful. Throws Err if fails for any reason.
See Mailgun documentation for unsubscribes:
- send
Send message using given params. See Mailgun documentation for available parameters:
http://documentation.mailgun.net/api-sending.html
send([ "from": "Test <me@example.com>", "to": "foo@example.com, bar@example.com", "subject": "Test Message!", "text": "Hey there!", ])
Returns response from Mailgun if successful. Throws Err if fails for any reason.
- sendEmail
- stats
Str:Obj[] stats(Str event, Date? start := null, Int? limit := null, Int? skip := null)
Get list of event stat items. Each record counts for one event per one day. Throws Err if fails for any reason.
Available event names:
- sent
- delivered
- bounced
- dropped
- complained
- unsubscribed
- opened
- clicked
See Mailgun documentation for stats:
- unsubscribes
Str:Obj[] unsubscribes(Int? limit := null, Int? skip := null)
Get list of unsubscribes.
- limit: Max number of records to return, or null for Mailgun default
- skip: Number of records to skip, or null for Mailgun default
See Mailgun documentation for unsubscribes:
- validateAddress
Str:Obj? validateAddress(Str address)
Validate the email address using Mailgun's email validation service