Download the PHP package ahmedwaleed/mailmerge without Composer
On this page you can find all versions of the php package ahmedwaleed/mailmerge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ahmedwaleed/mailmerge
More information about ahmedwaleed/mailmerge
Files in ahmedwaleed/mailmerge
Package mailmerge
Short Description This library provides handful of api's to send all sorts of email using different mail services
License
Informations about the package mailmerge
Introduction
MailMerge is meant to provide a handful of APIs to send all sorts of emails including (batch mails, single mail) using different mail service providers such as mailgun, pepipost, and sendgrid. It also defines the strategy for resending the failed emails using different mail services.
Requirements
- PHP >= 7.4
- Laravel >= 6.0
- Redis
MailMerge uses redis for saving events and logs so you must have redis install on your host.
Installation
MailMerge will automatically register itself using package discovery.
Once Composer is done, run the following command, it will migrate mailmerge migrations:
Configuring the package
You can publish the config file with:
This is the contents of the file that will be published at config/mailmerge.php
:
Please set your required env vars for all services specified in the config files. 'default' => env('DEFAULT_SERVICE', 'mailgun')
set this options for your default service which will be used when no service is explicitly specified when using mailmerge api.
Usage
This package registered all api endpoint you need, run php artisan route:list
to see all available endpoints.
Method | URI | Action | Middleware |
---|---|---|---|
GET HEAD | api/log | MailMerge\Http\Controllers\Api\MailLogsController@index | MailMerge\Http\Middleware\ApiAuth,MailMerge\Http\Middleware\ClientSwitcher |
POST | api/logs/mailgun-webhook | MailMerge\Http\Controllers\Api\MailgunWebhookController@handle | Mailmerge\Http\Middleware\VerifyMailgunWebhook |
POST | api/logs/pepipost-webhook | MailMerge\Http\Controllers\Api\PepipostWebhookController@handle | |
POST | api/logs/sendgrid-webhook | MailMerge\Http\Controllers\Api\SendGridWebhookController@handle | |
POST | api/mails/batch | MailMerge\Http\Controllers\Api\SendBatchController@handle | MailMerge\Http\Middleware\ApiAuth,MailMerge\Http\Middleware\ClientSwitcher |
POST | api/mails/message | MailMerge\Http\Controllers\Api\SendMailMessageController@handle | MailMerge\Http\Middleware\ApiAuth,MailMerge\Http\Middleware\ClientSwitcher |
POST | mailmerge/resend-batch | MailMerge\Http\Controllers\ResendBatchController@handle | web,Illuminate\Auth\Middleware\Authenticate |
Authentication
MailMerge uses very simple authentication method all you have to do is pass an authorization signature in the request header.
Send Single Email Message
-
Api Endpoint
-
Example Request Parameters
-
Example Response
- Example Code
Send Batch (Bulk Emails) Message
-
Api Endpoint
-
Example Request Parameters
-
Example Response
- Example Code
- service
- You can specify service in the api headers which you want to use for sending message For example:
- cc, bcc
- MailMerge also allows you to add cc and bcc to your message, you can add those in your request body. For example.
- attachment
-
With MailMerge you can send one or more attachments with batch message.
-
* Batch Mail Template
MailMerge uses its own email placeholder template for recipients custom attributes (variables) because of different integration of MSP so you don't have to worry about syntax different services.
- Syntax
`<% attribute.custom_attribute_name %>`
- Example
## Re-Send Batch Message
* Api Endpoint
Sending a batch message can be a time taking task on user end, it may take time for you to arrange all the recipents list that you want to send as batch message and what if your batch message failed so instead of doing all the heavy work again and again with MailMerge its now possible to resend your batch message using different service (mailgun, pepipost, sendgrid). MailMerge saves all of your sent batch messages so you can retry that batch message in future in case of some system failure or if there are so many failed or bounced emails, when you retry or resend batch message it handle the logic of sending that batch message only for failed recipients from last batch so you can retry that batch message as many times as you want until all the emails from that batch are sent successfully.
MailMerge provide a default view for handling your batch messages.
![resend batch message default view](https://lh3.googleusercontent.com/j9voc8ErhsRqlUDXQdFIubbDmAe_Kjr75uAiQjgKAViqNRj_WtwPQgzxICg2A5h0yIkcAcQUhhbox1dpkikNSMWsLOZ-fcCeIlYiGbHjJ6En1Sli6ek1fNQm5Zcs7vwylGq60_jUeO6OsBZUucjbAjI9gphaKCZ9RQPGBT6LL38Ac5DT1oO1zBNRudqky2RMwZr7H-QextqLudS5_8Cr6lunJrJQboaqbz5q1aeL7ma4SS8fzocr4bqT_Ba0r2WZAoSVPIZyv-fAyQ8m09PJU3L4E_671mFNulnMY0E-3WqBkuLIIaOL40RcSUKJ_bzSlNTfL2mfFhlg1DX8ozKDUc1avQZENjjAS7a2ZNHW6LCMAexiGTUZruPNXjkxpoDGIhxDHMki9znuRhmWnRqW8-u_wP2Y0wkf3KagPxbnI30-vqMihN3CmTzsVhq801Sy8JlaPi635SYXCfSfnRTEbF21nkraNl4QE7NOhGWpHvIeC-YgSV9d8EyfsBzJhVxkLHVHV_J9GmJuNZiAkcdHH78c6cldftZpE1YjqIOVM9h2ya7uqLQgwfxXjVnKwPbWZMrdRuKhJckvwhKgmcPnlO7hkAi0FY5NWlLMCvQuTswBskw2VLeTEiQKDLdIWs5872VUxDDnIfioHnkhYPJu_y__uCAZctvYLJd4THBaHLauH_r1TwHpwFZlWsZbNgjxXxOyW7L9yRkAHIA1dHxt-lkLbWvb7Qh2Ll5irU8N3heJ_vg=w888-h306-no)
but you're free to modify it as per your need.
You can run below command to publish MailMerge default view of resending batch messages.
Once the view is published you can find it inside `resources/views/vendors/mailmerge` directory.
## Logging
MailMerge provides centralized logging system for all supported email services using webhooks support, MailMerge register endpoint for each services so that you can add that url into your mail api webhook settings. You can find related docs for webhooks in following links: [mailgun](https://documentation.mailgun.com/en/latest/user_manual.html#webhooks), [pepipost](https://pepipost.com/features/webhooks/), [sendgrid](https://sendgrid.com/docs/for-developers/tracking-events/getting-started-event-webhook/).
Whenever there is new log your mail service will hit that webhook url and MailMerge handle that request and saves that log into redis server.
### Get Logs
- Request Query Parameters
- Items: (optional)
By default, the API will return 10 items but you can pass items param in a query to get items as per your need.
- Service (required)
* Example Response
- Original Response:
It include original payload from mail service.
- Normalized Response:
Normalized response that will be consistent across multiple services.
## License
MailMerge is licensed under the [MIT License](http://opensource.org/licenses/MIT).
All versions of mailmerge with dependencies
ext-curl Version *
ext-fileinfo Version *
ext-json Version *
guzzlehttp/guzzle Version ^6.3
kriswallsmith/buzz Version ^1.0
mailgun/mailgun-php Version ^3.0
nyholm/psr7 Version ^1.2
predis/predis Version ^1.1
sendgrid/sendgrid Version ^7.3
symfony/psr-http-message-bridge Version ^1.2
spatie/temporary-directory Version ^1.2