Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > General > Site Users Chat

Site Users Chat Use this forum for general chat, introductions, and to share your favourite websites.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2004-10-13, 11:52 PM
Guest
Guest
 
Posts: n/a
Default

Hi
Can any one tell me how to send embedded images in email?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2005-05-10, 04:45 AM
Junior Member
 
Join Date: May 2005
Posts: 1
immujeeb
Default

I dont know how to embed image in an email, but if u can give me ur emailing code, because my code is not working. Plzzz.
Reply With Quote
  #3 (permalink)  
Old 2005-05-10, 06:45 AM
Moderator
 
Join Date: May 2004
Location: Portugal
Posts: 143
gesf is an unknown quantity at this point
Send a message via ICQ to gesf Send a message via MSN to gesf Send a message via Skype™ to gesf
Default

Something like this:
Code:
<?php

$path = "path to the image file";

$fp = fopen($path, 'r');

do {
 Â* $data = fread($fp, 8192); Â* Â* Â* 
 Â* if (strlen($data) == 0) break;
 Â* Â* Â*$content .= $data;
} while (true);

$encoded_content = chunk_split(base64_encode($content));

$message .= $encoded_content . "\n";
$message .= "--" . $boundary . "\n";

$headers Â*= "From: \"You\"<you@yoursite.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";

$sent = mail('somebody@domain.com', 'Email with attachment', $message, $headers);

print ($sent) ? 'Done!' : 'Error!';

?>
Edited:
Oh... now i see... you said embedded and not attachment :P

Ok, just define your Content-Type as text/html and in your message (html) give a normal link (URL) to the image... with the img tag.


Hope it helps
__________________
Best Regards,
Gonçalo "GesF" Fontoura

Website : gesf.org
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:24 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.