![]() Once the data has been set to a public property, it will automatically be available in your view: Public $data //array with data for mail content So, you may pass data into your mailable class' constructor and set that data to public properties defined on the class: There are two ways to pass data to the view for email content:Īny public property defined on your mailable class will automatically be made available to the view. To send a plain-text email, use the text() method in build(): This is email content, sent with Laravel. The e-mail templates are loaded in the same way as views, you can use HTML tags, PHP code, Blade syntax and inject data into your email content.įor example, a simple blade template for email content: ![]() " view_name" is the name of the view that contains the template for email content. To build the e-mail message, use the view() method within the build() method of the mailable class: You may set "to", "cc", and "bcc" recipients within a single, chained method MailableClass($data)) To send the email, use this syntax in your Laravel application: If the subject isn't specified, Laravel will guess it from your class name, for example "User Mail". If the from address and name aren't specified, Laravel will use the Global "From" Address (defined in config/mail.php).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |