Hello all and thanks in advance, I am attempting to add an image in an email that is generated from php.
Here is the php code

$ttext = "
Hello,

$_POST[name], whose email address is $_POST[email] thought you may be interested in this event. 

$_POST[refurl]
$_POST[name] Has left you a personal note.
$_POST[note]

$_POST[name] sent this information from www.communitychapel.net.

<img>http://www.communitychapel.net/assets/Map.jpg</img>

We look forward to your visit!

";

the email shows the html code fro the link,
thanks again

Recommended Answers

All 6 Replies

Thank you testing now

Hi,

I think you are using the above code in message section of mail function. for example

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

I think you assign the image tags and other kind of information in the $message variable. Then you finally send mail to endusers. If you did like that then you will be in need of use some quotes format in $message variable. Here below I sent the sample code to send mail with picture. Please refer it...Also you use the table as you wish. otherwise you just enter the image tag in the quoted string like below.

//sample coe
<?
$message = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<body>
<table width="780" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="72">&nbsp;</td>
<td width="626" height="51"><img src="www.communitychapel.net/assets/Map.jpg " ><" width="235" height="51"></td>
<td width="74">&nbsp;</td>
</tr>
</table>
</body>
</html>';
?>

make sure the mail's Content-Type header is text/html:

i.e:

$headers = "Content-type:text/html";
mail($to, $subject, $message, $headers);

Some email providers (optionally) block external images, so sending an external image by email may not work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.