Support the ongoing development of Laravel.io →
Views Blade Mail
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

LimeBlast limeblast Joined 23 Dec 2013

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.