Laravel 将图像添加到电子邮件模板

时间:2021-06-06 21:51:30

标签: php laravel email

我是 Laravel 的新手,我需要在我的电子邮件中添加徽标。我尝试了几乎所有我看到的解决方案,第一张图片显示为损坏的 img,现在我根本无法发送邮件。

这是我的控制器:

public static function sendRefferanceMail($student_id, $reference_id)
{
    $reference = Reference::find($reference_id);


    if ($reference->is_confirmed == 0 || $reference->is_confirmed == 1 ) {
        //Create token with student's id
        $token = Helper::generateToken($reference_id);
        $is_token = Reference::where('token', $token)->count();
        while ($is_token > 0) {
            $token = Helper::generateToken($reference_id);
            $is_token = Reference::where('token', $token)->count();
        }
        $array = [
            'student_name' => $reference->getStudent->name,
            'student_surname' => $reference->getStudent->surname,
            'name' => $reference->referencer_name,
            'email' => $reference->referencer_email,
            'token' => $token,
            'referencer_id' => $reference->id,
            'student_id' => $student_id,
];
        Mail::send('/mailtemplates/refferance', $array, function ($message) use ($reference) {
            $message->from(env('MAIL_USERNAME'), 'Info');
            $message->subject("Referance");
            $message->to($reference->referencer_email);
        });

在我看来,我正在尝试将其用作

<tr>
                    <td class="wrapper">
                        <table role="presentation" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <img src="{{ $message->embed(public_path() . 'front/assets/images/logo.png') }}" alt="" ">
                                </td>
                                <td>
                                    <p>Hello {{$name}},</p>
                                    <p>Your appeal is approved.</p>
                                    <p><br></p>
                                    <p>Fırat University</p>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>

任何帮助如何解决这个问题?

0 个答案:

没有答案