Dear Friends!
i send image using email function and it cant show on the receiver side?? i used html script inside the massage body to send images. whats the solution?

Recommended Answers

All 6 Replies

post your code here...

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script src="ckeditor/sample.js" type="text/javascript"></script>
    <link href="ckeditor/sample.css" rel="stylesheet" type="text/css" />
<?php 


                                        if(isset($_POST['button']))
                                        {
                                            extract($_POST);

                                            $subject=$subject;
                                            $sender=$to2;
                                            $message=$message;
                                            $from=$from;


$random_hash = md5(date('r', time())); 
$headers= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= '"\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""'; 
$headers.=$from;
mail($sender,$subject,$message,$headers);
echo "email Send";

    }
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <table width="400" border="0" align="center">
    <tr>
      <td colspan="2" align="center"><strong>My Test Email</strong></td>
    </tr>
    <tr>
      <td width="103">Subject</td>
      <td width="287"><label>
        <input name="subject" type="text" id="subject" size="30" />
      </label></td>
    </tr>
    <tr>
      <td>Recepients</td>
      <td><label>
        <input name="to2" type="text" id="to2" size="30" maxlength="100" />
      </label></td>
    </tr>
    <tr>
      <td>From</td>
      <td><input name="from" type="text" id="from" size="30" maxlength="100" /></td>
    </tr>
    <tr>
      <td>Message</td>
      <td><label>
        <textarea  id="message" name="message" rows="10"></textarea>

        <script type="text/javascript">
            //<![CDATA[

                // This call can be placed at any point after the
                // <textarea>, or inside a <head><script> in a
                // window.onload event handler.

                // Replace the <textarea id="editor"> with an CKEditor
                // instance, using default configurations.
                CKEDITOR.replace( 'message', {
                    extraPlugins : 'tableresize' });

            //]]>
            </script>
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td align="center"><label>
        <input type="submit" style="background-color:#999" name="button" id="button" value="Submit" />
        &nbsp;
        <input type="reset" style="background-color:#999" name="button2" id="button2" value="Reset" />
      </label></td>
    </tr>
  </table>
</form>
</body>
</html>

If you can't send a picture inside the message as html.
You can only send it's URL
make sure the recverer does't get something like c:\local_user\my pictures\foto.jpg

If you can't send a picture inside the message as html.
Dear Sir!
I want to send image with html tags using text area.

Dear Sir!
I want to send image with html tags using text area.

Make sure that the fotolink points to the web and not to a local file

$fotolink="http://www.mysite.com/imagedir/foto.jpg";

		$uid = md5(uniqid(time()));
		// headers
		$emailHeaders="From: me@me.com \r\n";
		$emailHeaders.="Reply-To: me@me.com\r\n";
		$emailHeaders.= "MIME-Version: 1.0\r\n";
   		$emailHeaders.= "Content-Type: multipart/alternative; boundary=\"".$uid."\";\r\n\r\n";
		$EmailHeaders.= "\nMIME-Version: 1.0\n Content-Type: multipart/mixed;\n boundary=\"".$uid."\"";
   
		// message
		$emailMessage= "--".$uid."\r\n";
		$emailMessage.= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
		$emailMessage.= "Content-Transfer-Encoding: base64\n\n";
		
		$html ='<html><body><table width="100%" border="2" cellspacing="2" cellpadding="2" style="border-style: double; border-bottom-width:medium;"><th colspan="2" style="font-size:large">Tiltle</th>';
		$html.="<tr><td>more</td><td>comments</td></tr>";
		
		$html.="<tr><td>Foto</td><td><img src=\"".$fotolink."\" /></td></tr></table></body></html>";
		$emailMessage.= chunk_split(base64_encode($html))."\r\n";
		$emailMessage.= "--".$uid."\r\n";
		$emailMessage.= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
		$emailMessage.= "Content-Transfer-Encoding: 7bit\n\n";
			
		$emailMessage.="if can't recive html mail get this massage "\n\n";
		
		$emailMessage.= "--".$uid."\r\n";		

						
		$Mailok =mail($Mail_emailadress,"foto for you", $emailMessage, $emailHeaders);
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.