2

I have a mail template which contains a description and one large image . But while adding image to mail template body it wont display when the mail open . It shown as below :

enter image description here

I have tried this code :

$message = "<html><head></head><body>";
$message .= "<img src='link-image.jpg' alt='' /></body></html>";
$headers = "From: $from_email";
$headers .= "Content-type: text/html";

mail($to, $subject, $message, $headers);

But when sending a mail directly (Inserting image with insert option) , it shows directly when the mail receives. Can we get this similar functionality of inserting image ?

1
  • 1
    Use full path of the image to display image in mail. Commented Mar 23, 2018 at 9:28

1 Answer 1

0

As already stated in the comments. You might want to make the image available by downloading it from your server.

So instead of

<img src='link-image.jpg' alt='' />

you would use

 <img src='https://DOMAIN.TLD/images/link-image.jpg' alt='' />

Where 'domain.tld' is your domain and 'images' is you public image path.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.