Looking to hire Laravel developers? Try LaraJobs

laravel-docmail maintained by omarusman

Description
An laravel implementation for Docmail.
Author
Last update
2017/02/28 07:57 (dev-master)
License
Downloads
32
Tags

Comments
comments powered by Disqus

Laravel Package for Docmail

This packages provides an interface to the mail services of Docmail. The provide their services in many countries and are able to process mailings at fair rates.

Installing the package

You can install this package using Composer. Go to your commandline and run in the root of your project:

composer require omarusman/laravel-docmail

Next, open your config/app.php file and add the following service provider:

\Oozman\Docmail\DocmailServiceProvider::class,

Then add the following facade to your list of aliases:

'Docmail'   => \Oozman\Docmail\DocmailFacade::class,

Usage

\Docmail::sendFile(storage_path('temp/test.pdf'), function(\Oozman\Docmail\DocmailService $docmail) {
    // Name the mailing, defaults to the OrderRef.
    $docmail->getMailing()->setMailingName('Test Mailing');
    
    // Change the filename.
    $docmail->getTemplate()->setFileName('MyPrettyLetterFilename.pdf');
    
    // Add all the addresses you want.
    $docmail->addBasicAddress('John Doe', 'Testersroad 3', '32444 Testersvalley');

    // If you have a discountcode you can apply it.
    $docmail->getMailing()->setDiscountCode('');
});

API Reference

For the detailed API Reference please refer to the API Documentation.

Important notice

Although you can run the interaction with Docmail, within your controller. It is advised to make use of Jobs that are processed in the background. Although the processing is mostly done within a few seconds, the processing at the Docmail server can take up to a few minutes. Therefor background Jobs should be used to maintain optimal performance.

Read more on creating Jobs in the Laravel Documentation.