This application is written in PHP and gave the user the possibility to:
- Receive email on Mandrill Inbound
- Forward the email on another email/mailbox (like GMAIL) using Mandrill Outbound
Every email received will consume 1 send slot (being forwarded to the address you specified).
- config sample with domain example.com
- composer.json configuration file
- PHP >= 5.3.*
- Composer
- Mandrill account configured with MX/DKIM/SPF valid domain records
First download the repository and install Mandrill API dependency with composer:
$ git clone https://github.com/jonathanargentiero/mandrill-inbound-outbound-forward-php.git
$ cd mandrill-inbound-outbound-forward-php/
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
Edit these configuration files:
- Add a valid Mandrill API key in
config/settings.php
- Configure the receivers email addresses in
config/receivers.php
NOTE: A catch-all address is always required and defined with *
. You can still use the same configuration file for multiple domains registered on Mandrill (but the catch-all will be the common for all domains).
On Mandrill go to inboud > example.com > routes
and create a Route with these information:
When The Receiving Email Address Matches:
*@example.com
Post To URL:
http://mail.example.com/mandrill-inbound-outbound-forward-php/
Then save and press send test. After a while (30 seconds) you will receive a Mandrill sample email on the catch-all you defined in config/receivers.php
.
Make a final test sending from your usual mailbox a mail.
- Attachments mechanism should be improved because it's not working in every case.
- https://mandrillapp.com/api/docs/inbound.JSON.html#method=send-raw
- https://mandrill.zendesk.com/hc/en-us/articles/205583197-Inbound-Email-Processing-Overview
based on this GIST from Mathias Beugnon