mardi 3 mai 2016

How to define email subject in email template

I have email blade like this:

<?php
$title = 'title';
$text   = 'text';
?>

@include('emails.layouts.general')

In emails.layouts.general

<h1></h1>
<p></p>

I send email like :

$subject = 'some subject'

\Illuminate\Support\Facades\Mail::send($template, [],
    function ($m) {
    $m->to('test@test.com', 'test test')->subject($subject);
});

Does anybody have idea how I could define subject in blade :

<?php
$subject = 'subject';
$title   = 'title';
$text    = 'text';
?>

and set this subject when send email ?

EDITED:

I need something like: Set email subject in email blade:

<?php
$title   = 'title';
$text    = 'text';
$subject = 'subject';
Mail::setEmailSubjectForNextEmail($subject);
?>

@include('emails.layouts.general

or in controller :

$subject = somehowGetSubjectVariableFromTemplate($template);

\Illuminate\Support\Facades\Mail::send($template, [],
    function ($m) use ($subject) {
    $m->to('test@test.com', 'test test')->subject($subject);
});



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/24m1qIW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire