Log in

View Full Version : Inline image in e-mail



Lockerbie
04-30-2016, 04:01 PM
Hello,

I hope I can ask this questions here. I've looked and tried for some days now, but can't achieve quite what I want.
The problem is this:
For a few years now, I've been using a form on my website, which after submitting gets send to both the visitor and myself. But now, with updating this website, I got some errormessages/notices that I've been able to solve luckily. But at the same time, I thought it would be great to put a logo in the mail that gets send to the visitor. Easier said than done...

The website, www.cj-design.com and forum where this script ("Web2Mail") is from, seem to be abandoned. No reaction to my emails.
Searching the internet I found I have to use a 'Content-ID' for this, but do I set this myself, or do I have to let this ID rendered? Do I need just the name of the image, or the path to it as well?
And do I need the full base64-code, or is that not necessary when using 'Content-ID'?
(Off course I could just use the url to the image but that gets blocked by most email-clients because of spam-risks.)

The code I have so far (translated):

function sendHTMLEmailAuto($titel, $name, $email, $subject, $message){
include("web2mail_config.php");
$recipient = "$name <$email>";
$rand = md5(time());
$mime_boundary = $rand;
$sub = "$auto_subject to $name";
$text_version = "Dear $name, thank you for contacting us.\n\nConcerning $subject we received the following message:\n\n $message\n\nWe'll contact you as soon as possible through: $email.\n\nKind regards, \n\n$yourname\n\n\n.";
$html_version = "<html>\n<head>\n<style>\nA:link {text-decoration: none; color: $alink_color;}\nA:visited {text-decoration: none; color: $vlink_color;}\nA:hover {font-style: normal; color: $hlink_color; text-decoration: underline;}\nBODY{font-family: $html_font; font-size: $html_font_size; color: #000066;}TD {font-family: $html_font; color: #000066; font-size: $html_font_size;}\n</style>\n</head>\n<body>\n\nDear <B>$name</B>, thank you for contacting us.\n<br>Concerning <B>$subject</B> we received the following message:\n\n<br><br>$message\n<br><br>We'll contact you as soon as possible through: $email. \n<br><br>\nKind regards, <br><br>\n$yourname $surname.<br><br>\n\n<a href=\"http://www.domain.com\">Companyname.com</a>\n<br><br><a href=\"http://www.domain.com\"><img src=\"cid:imagename\" alt=\"Companyname.com\" width=\"90\" height=\"90\"></a><br>\n<br>\n<br>\n</div>";
$headers = "Van: $your_website <$admin_email>\r\n";
$headers .= "Reply-to: $admin_email\r\n";
$headers .= "Return-Path: $admin_email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; charset=\"iso-8859-1\"; boundary=\"$mime_boundary\";\r\n"; // added ; before boundary
$headers .= "This is a multi-part message in MIME format.\r\n";
$msg = isset($mime_boundary) ? $mime_boundary : '';
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; // deleted boundary
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $text_version."\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $html_version."\r\n\r\n";
$msg .= "--$mime_boundary--\r\n\r\n\r\n";
$msg .= "Content-Type: image/jpg; name=\"imagename.jpg\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n\r\n";
$msg .= "Content-ID: <imagename> ";
$msg .= "Content-Disposition: inline; filename=\"imagename.jpg\"\r\n";
$msg = stripslashes($msg);
mail ($recipient, $sub, $msg, $headers);

}

Please, can anyone give me some clues what to adjust so this will work correctly and the logo will be visible in most email-clients? Thanks in advance.

jscheuer1
04-30-2016, 04:38 PM
Do you have the web2mail_config.php file? That appears to be essential as it's included in the function and two or more variables appear to be undefined, apparently they are defined in the config file. If you don't have that file, I would assume that is the problem.

Lockerbie
04-30-2016, 04:47 PM
Hello JScheuer1,

Yes, off course: I've been using this script for a few years. ;-)

The code:

<?
$yourname = "Lockerbie";
$surname = "Familyname";
$your_website = "Companyname";
$your_webaddress = "http://www.domain.com";
$admin_email = "info@domain.com";


$show_ip = "no";
$auto_responder = "yes";
$auto_subject = "Automatic reply";
$error_messages = "yes";


$multipart_emails = "yes";
$html_font = "Verdana";
$html_font_size = "10pt";
$alink_color = "#000066";
$vlink_color = "#000066";
$hlink_color = "#CC0000";


$default_thank_msg = "no";
$thankyou_message_url = "http://www.domain.com/thanks.html";
?>

Lockerbie
04-30-2016, 06:22 PM
The original files.

Form.php:

<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="100%">
<tr><td align="left" width="15%">Your Name:</td>
<td align="left" width="80%"><input type="text" name="name" size="30" value="<? echo $_POST['name']; ?>"></td></tr>
<tr><td align="left" width="15%">Your E-mail:</td>
<td align="left" width="80%"><input type="text" name="email" size="30" value="<? echo $_POST['email']; ?>"></td></tr>
<tr><td align="left" width="15%">Subject:</td>
<td align="left" width="80%"><input type="text" name="subject" size="30" value="<? echo $_POST['subject']; ?>"></td></tr>
<tr><td align="left" width="15%">Message:</td>
<td align="left" width="80%">
<p align="left"><textarea cols="63" rows="10" name="message"><? echo $_POST['message']; ?></textarea></p>
<p align="left"><input type="submit" name="submit" value="Send Mail">
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>

mail_functions.php:

<?
function sendHTMLEmail($name, $email, $message, $subject, $recipient, $ip, $date, $time){
include("web2mail_config.php");
$recipient = "$yourname <$admin_email>";
$rand = md5(time());
$mime_boundary = "CJ Web2Mail V3.0_". $rand;
$text_version = "Submitted: $date - $time\nFrom: $name - $email\n\n\n$message\n\nIP: $ip\n\n\nPowered by CJ Web2Mail V3.0 © http://www.cj-design.com";
$html_version="<html>\n<head>\n<style>\nA:link {text-decoration: none; color: $alink_color;}\nA:visited {text-decoration: none; color: $vlink_color;}\nA:hover {font-style: normal; color: $hlink_color; text-decoration: underline;}\nBODY{font-family: $html_font; font-size: $html_font_size;}TD {font-family: $html_font; color: #000000; font-size: $html_font_size;}\n</style>\n</head>\n<body>\n\n<table border=\"0\" cellpadding=\"6\" cellspacing=\"0\" width=\"100%\">\n<tr>\n <td nowrap width=\"1%\">\n<b>Submitted</b>\n</td>\n<td width=\"99%\">$date - $time</td>\n</tr>\n<tr>\n<td nowrap width=\"1%\">\n<b>From</b></td>\n<td width=\"99%\">$name - <A HREF=\"mailto:$email\">$email</A></td>\n</tr>\n<tr>\n<td nowrap width=\"1%\" valign=\"top\">\n<b>Message</b></td>\n<td width=\"99%\">".nl2br($message)."</td>\n</tr>\n<tr>\n<td nowrap width=\"1%\"><b><small>IP Address</small></b></td>\n<td width=\"99%\"><small>$ip</small></td>\n</tr>\n</table><br>\n<br>\n<div align=\"right\"><i>Powered by <A HREF=\"http://www.cj-design.com\">CJ Web2Mail V3.0</A></i></div></body></html>";
$headers = "From: $name <$email>\r\n";
$headers .= "Reply-to: $email\r\n";
$headers .= "Return-Path: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; charset=\"iso-8859-1\"; boundary=\"$mime_boundary\";\r\n\r\n"; // added ; before boundary
$headers .= "This is a multi-part message in MIME format.\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; // deleted boundary
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $text_version."\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $html_version."\r\n\r\n";
$msg .= "--$mime_boundary--\r\n\r\n\r\n";
return mail($recipient, $subject, $msg, $headers);
}


function sendHTMLEmailAuto($name, $email, $subject){
include("web2mail_config.php");
$recipient = "$name <$email>";
$rand = md5(time());
$mime_boundary = "CJ Web2Mail V3.0_". $rand;
$sub = "$auto_subject to $name";
$text_version = "$name, thank you for emailing $your_website.\n\nWe will get back to you soon concerning '$subject'.\n\nKind Regards\n$yourname\n\n\nNote: This is an automated response, please do not reply to this\n\n\nPowered by CJ Web2Mail V3.0 © http://www.cj-design.com";
$html_version = "<html>\n<head>\n<style>\nA:link {text-decoration: none; color: $alink_color;}\nA:visited {text-decoration: none; color: $vlink_color;}\nA:hover {font-style: normal; color: $hlink_color; text-decoration: underline;}\nBODY{font-family: $html_font; font-size: $html_font_size;}TD {font-family: $html_font; color: #000000; font-size: $html_font_size;}\n</style>\n</head>\n<body>\n\n<B>$name</B>, thank you for emailing $your_website.\n\n<br><br>We will get back to you soon concerning '<I><B>$subject</B></I>'.\n<br><br>\nKind Regards<br>\n$yourname<br>\n<br>\n<br>\n<small>Note: This is an automated response, please do not reply to this</small><br>\n<br><div align=\"right\"><i>Powered by <A HREF=\"http://www.cj-design.com\">CJ Web2Mail V3.0</A></i></div>";
$headers = "From: $your_website <$admin_email>\r\n";
$headers .= "Reply-to: $admin_email\r\n";
$headers .= "Return-Path: $admin_email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; charset=\"iso-8859-1\"; boundary=\"$mime_boundary\";\r\n\r\n"; // added ; before boundary
$headers .= "This is a multi-part message in MIME format.\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; // deleted boundary
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $text_version."\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $html_version."\r\n\r\n";
$msg .= "--$mime_boundary--\r\n\r\n\r\n";
$msg = stripslashes($msg);
mail ($recipient, $sub, $msg, $headers);

}


function sendTextEmailAuto($name, $email, $subject){
include("web2mail_config.php");
$recipient = "$name <$email>";
$sub = "$auto_subject to $name";
$msg = "$name, thank you for emailing $your_website.\n\nWe will get back to you soon concerning '$subject'.\n\nKind Regards\n$yourname\n\n\nNote: This is an automated response, please do not reply to this\n\n\nPowered by CJ Web2Mail V3.0 © http://www.cj-design.com";
$headers = "From: $your_website <$admin_email>\r\nReply-To: $admin_email\r\n";
$msg = stripslashes($msg);
mail ($recipient, $sub, $msg, $headers);

}

?>

thankyou.php:

<?
if($sent){
?>
Thank you <? echo $name; ?>, we will contact you shortly.<br><br>
Your message:<br><br>
<table border="0" cellpadding="10" cellspacing="0" width="450">
<tr>
<td width="440"><small><? echo nl2br($message); ?></small></td>
</tr>
</table>
<br><br>
<?
if($show_ip == "yes"){
echo "<small>We have captured your IP (<I>$ip</I>) for security reasons</small>";
}
}
else{
print "$name, we could not send your message at this time, please try again later";
}
?>

web2mail.php:

<!-- You can insert a stylesheet here -->
<?
include "web2mail_config.php";
$path = __FILE__;
$path = preg_replace( "'\\\web2mail\.php'", "", $path);
$path = preg_replace( "'/web2mail\.php'", "", $path);
$send = false;
if(isset($_POST['submit'])){
$date = date("l d F Y");
$time = date("g:i:s a");
$ermsg = "";
$send = true;
$ip = $_SERVER['REMOTE_ADDR'];
$name = cleanUp($_POST['name']);
$email = cleanUp($_POST['email']);
$message = $_POST['message'];
$subject = cleanUp($_POST['subject']);
$emailvalid = is_valid_email($email);
if (!isset($name) || $name == ""){
$emsg = "<li>Please enter your name"; $send = false;
}
if (!isset($email) || $email == "" || $emailvalid == 1){
$emsg .= "<li>Your email address is missing or incorrect"; $send = false;
}
if (!isset($subject) || $subject == ""){
$emsg .= "<li>Please enter a subject"; $send = false;
}
if (!isset($message) || $message == ""){
$emsg .= "<li>Your message is blank"; $send = false;
}

if($send){
$sent = false;
include("mail_functions.php");
$message = strip_tags($message);
$message = stripslashes($message);
$subject = stripslashes($subject);
if($multipart_emails == "yes"){
if(sendHTMLEmail($name, $email, $message, $subject, $recipient, $ip, $date, $time)){
$sent = true;
}
}
else{
$recipient = "$yourname <$admin_email>";
$headers = "From: $name <$email>\r\nReply-To: $email\r\n";
$msg = "Submitted: $date - $time\nFrom: $name - $email\n\n\n$message\n\nIP: $ip\n\n\nPowered by CJ Web2Mail V3.0 © http://www.cj-design.com";
if(mail ($recipient, $subject, $msg, $headers)){
$sent = true;
}
}

if($sent){
if($auto_responder == "yes"){
if($multipart_emails == "yes"){
sendHTMLEmailAuto($name, $email, $subject);
}
else{
sendTextEmailAuto($name, $email, $subject);
}
}
if($default_thank_msg == "yes"){
include($path."/thankyou.php");
}
else{
header("Location: $thankyou_message_url");
}
}
else{
include($path."/thankyou.php");
}
}
}
if(!$send){
if(strlen($emsg) > 0 && $error_messages == "yes"){
echo "Your submission had the following errors:<br><br><FONT COLOR=\"red\">$emsg</FONT><br><br>";
}
include($path."/form.php");
}

function cleanUp($field)
{
//Remove line feeds
$ret = str_replace("\r", "", $field);
$ret = str_replace("\n", "", $ret);
// Remove injected headers
$find = array("/bcc\:/i",
"/Content\-Type\:/i",
"/Mime\-Type\:/i",
"/cc\:/i",
"/to\:/i");
$ret = preg_replace($find, "", $ret);
return $ret;
}

function is_valid_email($sender_mail) {
if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $sender_mail)) {
return 0;
}
else{
return 1;
}
}

?>

web2mail_config.php:

<?
$yourname = "Your Name";
$your_website = "Your Site Name";
$your_webaddress = "http://www.yoursite.com";
$admin_email = "yourname@youremail.com";

$show_ip = "yes";
$auto_responder = "yes";
$auto_subject = "Auto Responder";
$error_messages = "yes";


$multipart_emails = "yes";
$html_font = "verdana";
$html_font_size = "10pt";
$alink_color = "#11116E";
$vlink_color = "#11116E";
$hlink_color = "#000000";


$default_thank_msg = "yes";
$thankyou_message_url = "";
?>

jscheuer1
04-30-2016, 07:00 PM
Right, I downloaded that package later to see what was in it. So what ever made you think you could throw an image in there?

Anyways, in the absence of any other help or documentation, I think you've pretty much answered your own question. Though that might not be what you meant exactly. "the full base64-code" - that should work if used directly in the image tag (here):


<img src=\"cid:imagename\"

I'd try replacing the red part with it (can be a variable passed in from elsewhere, but not a script that returns the image).

Here's a handy online utility for converting the image if you need it, after conversion you can even scroll down to get the actual img tag, from which you can extract the exact src attribute required:

http://base64.wutils.com/encoding-online/image-to-base64/

I was surprised how (relatively speaking) little text was required to encode a fairly good sized image. I used an optimized image, which might be a good idea, nevertheless it wasn't an overwhelming amount of text for a good sized photo. For a small logo, it should be quite manageable, though setting it separately as a variable would be good. I think there are PHP GD scripts for returning the encoded data, those would work as well.

Lockerbie
04-30-2016, 08:05 PM
I guess there have to be another adjustment, because this still isn't working. With the base64-code instead of the 'cid:imagename'-part doesn't show an image in Outlook or in Gmail...

jscheuer1
04-30-2016, 08:40 PM
We might need more help on this. That said - What exact code are you using? Did you test it on a plain html page inside an img tag as its src attribute to verify the code is correct? Does it have the proper data:image/image type;base64, prefix? where image type is for example png or jpeg?

Anyways, what exact code did you put in there?

Lockerbie
05-01-2016, 10:40 AM
When I use:

function sendHTMLEmailAuto($titel, $name, $email, $subject, $message){
include("web2mail_config.php");
$recipient = "$name <$email>";
$rand = md5(time());
$mime_boundary = $rand;
$sub = "$auto_subject to $name";
$text_version = "Dear $name, thank you for contacting us.\n\nConcerning $subject we received the following message:\n\n $message\n\nWe'll contact you as soon as possible through: $email.\n\nKind regards, \n\n$yourname\n\n\n.";
$html_version = "<html>\n<head>\n<style>\nA:link {text-decoration: none; color: $alink_color;}\nA:visited {text-decoration: none; color: $vlink_color;}\nA:hover {font-style: normal; color: $hlink_color; text-decoration: underline;}\nBODY{font-family: $html_font; font-size: $html_font_size; color: #000066;}TD {font-family: $html_font; color: #000066; font-size: $html_font_size;}\n</style>\n</head>\n<body>\n\nDear <B>$name</B>, thank you for contacting us.\n<br>Concerning <B>$subject</B> we received the following message:\n\n<br><br>$message\n<br><br>We'll contact you as soon as possible through: $email. \n<br><br>\nKind regards, <br><br>\n$yourname $surname.<br><br>\n\n<a href=\"http://www.domain.com\">Companyname.com</a>\n<br><br><a href=\"http://www.domain.com\"><img alt=\"imagename.jpg\" src=\"data:image/jpeg;base64,/1234567890thetotalcodeofthebase64here\" width=\"90\" height=\"90\"></a><br>\n<br>\n<br>\n</div>";
$headers = "Van: $your_website <$admin_email>\r\n";
$headers .= "Reply-to: $admin_email\r\n";
$headers .= "Return-Path: $admin_email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; charset=\"iso-8859-1\"; boundary=\"$mime_boundary\";\r\n"; // added ; before boundary
$headers .= "This is a multi-part message in MIME format.\r\n";
$msg = isset($mime_boundary) ? $mime_boundary : '';
$msg .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; // deleted boundary
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $text_version."\r\n\r\n";
$msg .= "--$mime_boundary\r\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
$msg .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$msg .= $html_version."\r\n\r\n";
$msg .= "--$mime_boundary--\r\n\r\n\r\n";
$msg .= "Content-Type: image/jpg; name=\"imagename.jpg\"\r\n";
$msg .= "Content-Transfer-Encoding: base64\r\n\r\n";
$msg .= "Content-ID: <imagename> ";
$msg .= "Content-Disposition: inline; filename=\"imagename.jpg\"\r\n";
$msg = stripslashes($msg);
mail ($recipient, $sub, $msg, $headers);

}

The results are:
- Outlook 2010 doesn't show a picture, only a red cross,
- Gmail doesn't show a picture, only the alt-text,
- The emailprogram on Android-devices shows the logo directly, ánd there is this button 'show all images' (but this is the only one, already visible).

jscheuer1
05-01-2016, 03:15 PM
I'm looking on Google and all I see about using images in email generated via PHP is to just to include the src to the image (full url on the server) in the image tag. Or, and I'm thinking this is what you're trying to do with your code, it's suggested that PHPMailer can include the image directly in the mail. It's available for free with documentation here:

https://github.com/Synchro/PHPMailer

I would caution you not to get your hopes up too much though. There are email programs and there are email programs. For instance, using gmail - I see all images without having to give permission. When I signed up for this integrated web service it was explained that, because gmail is a highly secure system you can see all images immediately without fear of security violations. Whereas my previous program which was simply one where I downloaded mail from the server would not show any images under any circumstances unless I told it to for either a particular message, or always for messages from a particular sender. I'm pretty sure Outlook (or at least some versions of it) is like that. Many older programs that are on your computer and that simply download messages from the server are like that, or worse - simply do not show any images. It may be a configuration option, but many will stringently warn against enabling images.

jscheuer1
05-01-2016, 03:43 PM
I also found a much simpler looking package at:

http://www.phpclasses.org/package/3685-PHP-Send-HTML-messages-with-images-and-attachments.html

Also free, but you have to sign up for it, which I did using one of my existing accounts. The code looks really easy to use.

Anyways, looking at these packages, I see why it's so complicated. I would recommend using one of them or another one with support, rather than this old package you currently have that's not working.


Yet another popular package:

http://swiftmailer.org

Lockerbie
05-01-2016, 05:36 PM
Hello John,

Earlier today I tried sending it with the full url to the image in the html-part. The result is that this image is automatically visible in Gmail and Android devices, but (off course...) not in Outlook. After that, I forwarded the e-mail I got in Outlook to Gmail, and suddenly the image in this Outlook-mail showed up! Just not visible in Outlook itself, as it seems. Probably a config somewhere, but I can live with that. At least the image (logo) is visible, and probably will be in most email-clients.

Off course I've looked at your suggestions, and I've even sent out a tweet to James, who wrote this script. He already replied and confirmed that the url to the image needs to be the full url, so I'll use that (and perhaps will take another look into the Outlook-config).

So thank you John and James!

jscheuer1
05-01-2016, 06:28 PM
I haven't tried this stuff out but I've had a fairly good look at 3 of these PHP email scripts - three besides the one you were working on. From that I can tell that embedding the base 64 is the way to go, yet it's more complicated than what I at first suggested. Of the various PHP scripts I was looking at this one looks the easiest to use:

http://www.phpclasses.org/package/3685-PHP-Send-HTML-messages-with-images-and-attachments.html

It's free, but requires a simple registration to download it. I think you might actually be happier with it. Two snippets (first from the main script page, the part you configure):


#add image to be embeded
$img1 = $sec->embed('php-power-white.gif');

Easy to just enter the relative url to your image. And the main function on the include that does the heavy lifting and ties it in with the rest of the email in the correct manner:


function embed($file) {
if(is_file($file)) {
$basename = basename($file);
$fileinfo = pathinfo($basename);
$contentid = md5(uniqid(time())).".".$fileinfo['extension'];
$embedheader = "--{$this->emailboundary}\r\n";
$embedheader .= "Content-Type: ".$this->mime_type($file)."; name=\"{$basename}\"\r\n";
$embedheader .= "Content-Transfer-Encoding: base64\r\n";
$embedheader .= "Content-Disposition: inline; filename=\"{$basename}\"\r\n";
$embedheader .= "Content-ID: <{$contentid}>\r\n\r\n";
$embedheader .= chunk_split(base64_encode(fread(fopen($file,"rb"),filesize($file))),72)."\r\n";

$this->embed[] = $embedheader;

return "<img src=3D\"cid:{$contentid}\">";
} else {
die('The File '.$file.' does not exsist.');
}
}

Now of course that won't work just on its own. It does show more or less how a proper cid is created (at least what's involved) and used with the base 64 embed. What you had was close, but lacked certain real time parts of the process and the direct linkage to the email, possibly even lacked proper placement for some of the parts, and had no provision for generating the base 64 code. Even with the above operating in its full code you would need GD or at least base64_encode (which might not require GD, not sure - most PHP comes with GD anyway).

I'm still not convinced this will work in all email clients. But I suspect it will work in more than simply using the full url or embedding base 64 in the manner I had first suggested.

But if you're happy with what you have now, I'm not complaining.

Lockerbie
05-02-2016, 01:22 PM
Thanks John for all your effort.
I'm just not sure yet how to attach this to my form...

jscheuer1
05-02-2016, 05:16 PM
Right, I'm kind of looking at it, as it interests me. I have discovered that the script I "like" (because of its simplicity) is 2007 or so - So it's out of date.

Before I discovered that, I thought the best thing would be to just switch to it. But now I'm thinking of possibly adapting what it reveals about base 64 embedded images into what you already had.

The only other alternative would be to start from scratch with one of the more up to date mail packages, or just keep what you have now.

Lockerbie
05-09-2016, 04:31 PM
Thanks John. I've been away for a few days, but I'll look into it soon.