Displaying Image in an Email-Body

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Displaying Image in an Email-Body

Post by devarishi »

Hi,


Please consider the PHP Script given below. When email is received no image is displayed in the body of the message. I have tested it by sending an email to my yahoo id as well as to our internal domain on Lotus Notes client.

Code: Select all

<?php
 
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Test Mail<info@company.com>;" . "\r\n";
 
$message = "<p>Testing Image <p> <img src='contact.jpg' />";
 
$status = @mail("users@company.com,someUser@yahoo.com","Test", $message, $headers);
?>

So, how can we get images displayed in an email-body with advanced / graphics features enabled?


Note: Only an icon with a X is displayed.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Displaying Image in an Email-Body

Post by requinix »

Code: Select all

<img src='contact.jpg' />
So how is the email client supposed to know where this image is?
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Re: Displaying Image in an Email-Body

Post by devarishi »

tasairis wrote:

Code: Select all

<img src='contact.jpg' />
So how is the email client supposed to know where this image is?
DevNet Master has rightly been designated to your name. :lol: :bow:

Just one point: Now image is being displayed in my yahoo email but not in Lotus Notes Client. Well, I checked on outlook web also and it displays some security warning but then we can enable display of images. So, I think Lotus Notes has some features / settings that need to be corrected.

By the way, thanks again!

This is how I corrected the line (as hinted by you):
tasairis wrote:

Code: Select all

<img src='Fully Qualified URL/contact.jpg' />
Post Reply