Jump to content

Include/ attach pictures in eMails instead of link to server


Recommended Posts

Dear all,

 

I have a specific question regarding the Prestashop eMail module. By default Prestashop includes the Shop Logo into the eMail via the variable {shop_logo}. This function is brilliant as it includes the shop logo into the eMail (rather than just linking to it), so that most eMail clients show the picture automatically when opening the eMail (as it is no security risk as nothing is loaded from the server).

 

Now I want to include one additional picture into the eMail (In my case: The signature of the shop owner at the bottom of the eMail). From what I can see I can only include this second picture via the standard "Include-Picture" function of the WYSIWYG editor. Unfortunately this makes the eMail only linking to the picture on the server. This of course makes most eMail clients not show the additional picture (see screenshot due to the default security-setting of most eMail clients to not load content from an external server).

 

post-283581-0-83491900-1319115795_thumb.jpg

 

Therefore my question is the following:

1) Is there a possibility to include another picture into the eMail? (--> the same way than the logo is integrated)

2) Or is there maybe another variable such as {shop_logo} which could be "misused" for doing so?

3) Is there maybe a possibility to create another picture-varialbe e.g. {shop_signature} which could be linked hardcoded to a specific picture on the server?

 

Best regards and thanks a lot ina advance,

SirDaedalus

Link to comment
Share on other sites

  On 10/20/2011 at 1:14 PM, Hermeswein said:

1) Is there a possibility to include another picture into the eMail? (--> the same way than the logo is integrated)

Yes, requires changes/overrides to some files.

 

  Quote
2) Or is there maybe another variable such as {shop_logo} which could be "misused" for doing so?

No

 

  Quote
3) Is there maybe a possibility to create another picture-varialbe e.g. {shop_signature} which could be linked hardcoded to a specific picture on the server?

Yes, see reply to 1.

 

Short of making the changes above, a data URI may be your answer which is basically a way to include data in-line in e.g. a HTML email. You just add a normal img element but instead of using a normal URL in the src attribute you provide a data URI. This is basically equal (and simpler) to the Swift's method of inlining an image in the HTML email using a cid URI.

 

There are several web URLs that can covert an image input to data URI output; Google it. Let me know if you have difficulty finding one.

Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...

This applies to Prestashop 1.4 and is a core modification

  1. Go to the img folder and upload the image you wish to include in your e-mail. Lets call this "logo_mail_second.jpg"
  2. Open Mail.php inside the classes directory
  3. Around line 180 you will find
    		$templateVars['{shop_logo}'] = (file_exists(_PS_IMG_DIR_.'logo_mail.jpg')) ?
    		$message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail.jpg'))) : ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ?
    		  $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo.jpg'))) : '');
    


  4. Below these three lines you can insert a copy and adapt it to your needs.

 

If you insert this code below the original:

 

$templateVars['{shop_logo_second}'] = (file_exists(_PS_IMG_DIR_.'logo_mail_second.jpg')) ?
$message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail_second.jpg'))) : ((file_exists(_PS_IMG_DIR_.'logo_mail_second.jpg')) ?
  $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail_second.jpg'))) : '');

 

- You can output the image (logo_mail_second.jpg) in your e-mails by writing <img src="{shop_logo_second}" />

Edited by Carlsen (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...