I am very excited to announce the support for the Mailgun email delivery service in our ColdBox Mail Services module (cbmailservices
) thanks to Scott Steinbeck.
What is Mailgun
Mailgun is an email delivery service for sending, receiving, and tracking emails. You can find a great introduction here: https://www.mailgun.com/blog/product/getting-started-with-mailgun-introduction-to-platform-training/
What Is cbmailservices?
Sending email doesn't have to be complicated or archaic or sad. The ColdBox Mail Services (cbmailservices
) module will allow you to send email in a fluent and abstracted way in multiple protocols for many environments. The supported protocols are:
- CFMail - Traditional
cfmail
sending - File - Write emails to disk
- InMemory - Store email mementos in an array. Perfect for testing.
- Null - Ignores emails sent to it.
- Postmark - Send via the PostMark API Service (https://postmarkapp.com/)
- MailGun - Send via the MailGun API Service (https://www.mailgun.com)
It also sports tons of useful features for mail sending:
- Async Mail
- Mail Queues
- Mail merging of variables
- Mail attachments, headers and parameters
- View and Layout+View rendering for mail
- Mail tracking
- Multiple mailers
- Success and Error callbacks
- So Much More!
You can read the full docs for our mail services here: https://coldbox-mailservices.ortusbooks.com/essentials/configuration#mail-protocols. Let's check out how nicely you can send fluent emails:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
newMail( to : "email@email.com" , from : "no_reply@ortussolutions.com" , subject : "Mail Services Rock" , type : "html" , // Can be plain, html, or text bodyTokens : { user : "Luis" , product : "ColdBox" , link : event.buildLink( 'home' ) } ) .setBody( " <p>Dear @user@,</p> <p>Thank you for downloading @product@, have a great day!</p> <p><a href=" %40link%40.html ">@link@</a></p> " ) .addAttachment( expandPath( "/tmp/reports/report.pdf" ) ) .setReadReceipt( "myemail@email.com" ) .send() .onSuccess( function ( result, mail ){ // Process the success }) .onError( function ( result, mail ){ // Process the error }); |
Add Your Comment