Skip to content

This is an Inbound Parser for Postmark meant to be used with Laravel.

Notifications You must be signed in to change notification settings

camelCaseD/postmark-inbound-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Postmark Inbound Parser

Build Status Coverage Status Scrutinizer Code Quality

This is an Inbound Parser for Postmark meant to be used with Laravel.

How To Use

Config

Add the following service provider to app/config/app.php:

'Camelcased\Postmark\PostmarkServiceProvider',

You can also add the following alias:

'PostmarkEmail'   => 'Camelcased\Postmark\PostmarkEmail',

Basics

Then anywhere within your app you can use the following:

PostmarkEmail::from();
PostmarkEmail::to();
PostmarkEmail::body(); // Auto-detects if message contains html or text only.
PostmarkEmail::bodyIsText();
PostmarkEmail::bodyIsHtml();
PostmarkEmail::subject();
PostmarkEmail::replyTo();
PostmarkEmail::cc(); // Returns array if more than one. Ex: ['someone@somewhere.com', 'hi@awesome.com']. Returns string if only one.
PostamrkEmail::bcc(); // Returns same as cc;

Attachments

Attachments are slightly more complicated:

PostmarkEmail::hasAttachments() // Returns true or false
PostmarkEmail::attachments(); // Returns array of attachments

Looping through multiple attachments:

if (PostmarkEmail::hasAttachments())
{
  $attachments = PostmarkEmail::attachments();

  foreach ($attachments as $attachment) {
    $attachment->Name();
    $attachment->Content(); // Returns base64 encoded string
    $attachment->DecodedContent(); // Returns decoded value
    $attachment->Type(); // Or use $attachment->MIME()
  }
}

License

MIT license

About

This is an Inbound Parser for Postmark meant to be used with Laravel.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages