0

Click the link to see image

image does not show due to this link (https://ci3.googleusercontent.com/proxy/hO1fKO-OzbNbCh9Ip6yMDq7EyvRtsvnwWUU6siZfCWnzEbuR1APyylsxtFFglTIoHOgxi40F_vgTxz6FQHXrwcQ=s0-d-e1-ft#https://fe25-210-56-2-6.in.ngrok.io/api/opened)

When I remove this link to (https://fe25-210-56-2-6.in.ngrok.io/api/opened) it will show the image

Email template Code:

<img src="https://fe25-210-56-2-6.in.ngrok.io/api/opened" alt="" width="100" height="30">

Controller

 public function opened()
{
    header('Content-type:image/jpg');
    return file_get_contents(public_path('/images/user.jpg'));
}
  • Is https://fe25-210-56-2-6.in.ngrok.io/api/opened supposed to be an image? It returns as `text/html` right now for me. – HTeuMeuLeu Oct 04 '22 at 07:54
  • For me to but it it will show image in G mail Click the above link please – muhammad zubair Oct 04 '22 at 07:57
  • its because ..... i use NGROK for hosting.... Gmail does not call the api and does not recognized due to NGROK does not return response to email. Try to use Cloudflared tunnels instead of NGROK.... it worked for my case...!!! – muhammad zubair Oct 13 '22 at 05:33

1 Answers1

0

You cannot embed external images for security reasons, you might include it in email and show it. Example of mail sent with PHPMailer + Laravel:

private function designaPatrimonial($mail){
   $mail->AddEmbeddedImage(base_path('public/mails/pic-finger-up.png'), 'finger');
   return '<img src="cid:finger">';
}

You have to embed the image via AddEmbeddedImage with a name in the second parameter of the function, then you call it from the html like src="cid:Name_of_your_image"

This will attach your image to the mail and show it where you call it but won't be as attached file in the mail.

You have more info here: embedding image in html email

I hope this help you!