FrancescoMussi
FrancescoMussi

Reputation: 21610

Mailer class. Send method

I have a problem with the send method of mailer class:

public function deliver()
{
         $self = $this;
         return \Mail::send($this->body, $this->data, function($message) use($self)
    {
        $message->to($self->email, $self->to)->subject($self->subject);    
    });
}

I retrieve $this->body from a form. And i want to sent it as TEXT. just plain text. But somehow i am forced to send VIEW. So if in the body field i write the name of a view, like 'master', the mail is sent with master view as content. If i write plain text, the app break and i get an error that the text inserted is not a view.

How can i do to send only text?

Thank you!

Upvotes: 0

Views: 299

Answers (1)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87719

This is how you send it without a view:

Mail::send([], [], function($message) {

        $message->setBody('your full text body, or html...');

        $message->to('[email protected]');

        $message->subject('my subject');

    });

Upvotes: 1

Related Questions