Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Posts
    38
    Plugin Contributions
    0

    help question Inline Image in Emails as Attachment

    Hello all!

    I tried to send my email header as an inline image, so customers may not need to download the image seperately. This works for a lot of newsletters and looks far more professional to me.

    I know that the image must be attached to the email by a base64-enconding and a cid no. I created a little function in php to send my logo-file via email in this mime-coding and received that well.

    In my search to include this file with its encoding to zen-carts email functions I found that in class.phpmailer.php there is already such a function to base64-encode an attachment.

    How do I use this?

    I tried to put in my values like this:
    PHP Code:
    function AddEmbeddedImage($path="email/"$cid$name "rr-h1.gif"$encoding "base64",
      
    $type "image/gif") {

        if(!@
    is_file($path))
        {
          
    $this->SetError($this->Lang("file_access") . $path);
          return 
    false;
        }

        
    $filename basename($path);
        if(
    $name == "")
        
    $name $filename;

        
    // Append to $attachment array
        
    $cur count($this->attachment);
        
    $this->attachment[$cur][0] = $path;
        
    $this->attachment[$cur][1] = $filename;
        
    $this->attachment[$cur][2] = $name;
        
    $this->attachment[$cur][3] = $encoding;
        
    $this->attachment[$cur][4] = $type;
        
    $this->attachment[$cur][5] = false// isStringAttachment
        
    $this->attachment[$cur][6] = "inline";
        
    $this->attachment[$cur][7] = $cid;

        return 
    true;
      } 
    But my image doesn't come in my inbox...

    Does anybody use this and knows a HowTo?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Inline Image in Emails as Attachment

    Skip the changes you posted above. That's the wrong approach.

    Instead, replace your /includes/functions/functions_email.php file with the (experimental) one in the attached zip file.
    Then edit your /email/email*.html template files and for any IMG tag you want the image to be embedded for, simply add embed="yes" inside the IMG tag, like this:
    Code:
    <img src="email/header.jpg" embed="yes" />
    You can do similarly in newsletters if you manually edit the raw HTML before sending and set the embed attribute appropriately.
    Attached Files Attached Files
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    May 2007
    Posts
    38
    Plugin Contributions
    0

    Default Re: Inline Image in Emails as Attachment

    That's working!

    Thank you very much!

    Will this be part of a future version ?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Inline Image in Emails as Attachment

    Yes, that code comes from the unreleased v1.3.9 files.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 10 Jan 2013, 07:25 AM
  2. Emailing an attachment
    By enquirer66 in forum General Questions
    Replies: 1
    Last Post: 14 Aug 2010, 05:00 AM
  3. images inline with text next to main product image
    By JimmyV in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 27 Apr 2009, 11:15 PM
  4. Image, Description, Buybox Div Box inline together
    By ivogue in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Mar 2009, 05:54 AM
  5. one image on home page & inline nav.
    By jill8026 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Jun 2007, 07:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR