hpolthof / laravel-docmail by hpolthof

An laravel implementation for Docmail.
3,126
2
2
Package Data
Maintainer Username: hpolthof
Maintainer Contact: hpolthof@gmail.com (Paul Olthof)
Package Create Date: 2015-09-10
Package Last Update: 2017-02-28
Language: PHP
License: MIT
Last Refreshed: 2024-11-17 03:03:21
Package Statistics
Total Downloads: 3,126
Monthly Downloads: 147
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 3
Total Open Issues: 1

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 hpolthof/laravel-docmail

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

\Hpolthof\Docmail\DocmailServiceProvider::class,

Then add the following facade to your list of aliases:

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

Usage

\Docmail::sendFile(storage_path('temp/test.pdf'), function(\Hpolthof\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.