Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sane Laravel Mail example code
<?php
// note, to use $subject within your closure below you have to pass it along in the "use (...)" clause.
$subject = 'Welcome!';
Mail::send('emails.welcome', ['key' => 'value'], function($message) use ($subject) {
// note: if you don't set this, it will use the defaults from config/mail.php
$message->from('bar@example.com', 'Sender Name');
$message->to('foo@example.com', 'John Smith')
->subject($subject);
});

Hey man, i still dont get it what is a 'emails.welcome' and ['key' => 'value'] ?! would be nice if you want tell me about it :)

shahidkarimi commented Aug 18, 2016

I dont want the template. How to send simple email to any email address?
Mail::send("test@test.com","hi","Hello body")

Sending simple email is just a headache in Laravel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment