mercredi 29 juillet 2020

Sending image in the mail in laravel

I am trying to send auto reply to the newly registered user and I want to send them an image rather than the text but when I try to send the image the mail does sent but image receive is broken. Studied many answers from stackoverflow as well tried many other solutions from the internet but nothing seems to be working. here is my mail class.

<?php

 namespace App\Mail;

 use Illuminate\Bus\Queueable;
 use Illuminate\Mail\Mailable;
 use Illuminate\Queue\SerializesModels;

 class autoMail extends Mailable
 {
  use Queueable, SerializesModels;

/**
 * Create a new message instance.
 *
 * @return void
 */
public function __construct()
{
    //
}

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    return $this->subject("Subject")
            ->view('emails.autoemail');
}
}

And here is my function which is calling this mail class.

Mail::to($request->email)->send(new autoMail());

And last but not the least my view which I am sending as a mail.

<!DOCTYPE html>
<html>
<head>
    <title>Auto Email</title>
</head>
<body>
    <img src="">
</body>
</html>

Any help would be appreciated as I am stuck here for so much time. Thank you in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire