Sane Laravel Mail example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
}); |
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
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 :)