lundi 29 janvier 2018

Laravel-Mail: How to pass ->attachData to view

I'm trying to use an inline attachment in laravel mail but seems unfortunate. I also tried this one but doesn't work by embeding of raw data. I have a base 64 image/png here is an example of it.

Now I'm trying to use attachData but how can I pass the ->attachData to my mailtransaction.blade. I supposedly get the attachData from my controller but what variable should I call?

Controller.php

Mail::send(['html'=>'mailtransaction'], $data_content, function($msg) use ($to, $issueType){
        $msg->to($to); // change this upon finishing
        $msg->attachData($request->getBase64, 'test.png', ['mime'=>'image/png']);
        $msg->subject($issueType);
      });

mailtransaction.blade

<!DOCTYPE html>
<html>
<head>
</head>
<body style="width:100%;">
    <div style="border:0px solid #000; width:1000px !important;">
        <div style="display: inline-block;">
            <img src="" height="50px" width="50px">
        </div>
        <div style="display: inline-block; vertical-align: top;">
            <div style="font-size:24px; margin-bottom: -10px;">Fraud Detection Tool</div>
            <div>Suspicious Transaction details</div>
        </div>
        <hr style="border:0px; border-bottom:1px solid #000; width:1000px;">
        <div class="container">
            
            //I supposedly get the attachData from my controller but what variable should I call?
        </div>
        <hr style="width:1000px;">
        <div class="container_mail" style="width:600px !important;">
            <img src="" height="auto" style="max-width: 1000px">
        </div> 
    </div>
</body>
</html>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire