Why my mail not displaying images in php

$heading = "Diffie Forgot Password ";
				$body = "<html><head></head><body><h3>Reset Your Password</h3>";
				$body .= "<br>Dear $username we get an request for reset your password <br><br>To reset your password click on the below link :<br><br>$url<br><br><br> If you not request for password ignore this email your password remain same. ";
				$body .= "<br><img src='img/logo.jpg' width='150px' height='120px'></body></html>";


$header = array(
						"From: admin@admin.com",
						"MIME-Version: 1.0",
						"Content-Type: text/html;charset=utf-8"
						);
				//$body = html_entity_decode($body, ENT_QUOTES, "utf-8");
				mail($email, $heading, $body, implode("\r\n", $header));

Hi,
you appear to be sending an email to the user and are using a relative link to the image. Your img should be something like http://www.example.com/logo.jpg so it knows where to get it from.

Also your English needs amending in your message.

$body .= "<br>Dear $username we GOT A request TO reset your password <br><br>To reset your password click on the below link :<br><br>$url<br><br><br> If you DID not request A password RESET ignore this email AND your password WILL remain THE same. ";

hth

1 Like

Not being picky but I would use received rather than got

Agreed. I considered changing it but was trying not to change too much as it wasn’t the actual question from the op :slight_smile:

1 Like

I know what you mean; it can be all to easy to get off topic.

Emails can be a pain. Writing code for email clients is not the same as writing code for browsers. At best, code for email clients is like code for twenty year old browsers. As for images, some email clients intentionally do not show them, and some may even consider emails with certain images as spam and reject the entire email.

Just the same, I think changing the path to an absolute path would be worth trying.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.