Well, you'd use the API for Mandrill, Mailgun or such. You'd write the email in Markdown and then you parse it to HTML just before sending the API request and use the Markdown version for the plain text.
Here's an example of how we override the Mandrill transport class:
<?php namespace ScubaClick\Email;
use Illuminate\Mail\MailServiceProvider;
use ScubaClick\Email\Transport\MandrillTransport;
class EmailServiceProvider extends MailServiceProvider
{
/**
* {@inheritdoc}
*/
protected function registerMandrillTransport($config)
{
$mandrill = $this->app['config']->get('services.mandrill', []);
$this->app->bindShared('swift.transport', function() use ($mandrill)
{
return new MandrillTransport($mandrill['secret']);
});
}
}
In MandrillTransport we override the send method to inline styles to keep the templates clean, but I don't see a reason why that can't be used to parse the Markdown,
You then also have to add the new email provider to the providers list in app/config/app.php and remove Illuminate\Mail\MailServiceProvider to make it work.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community