PrestaCraft on Facebook

Please like our page on Facebook to get notifications about new tutorials :)


PrestaCraft

Tutorials

Many times there is necessity to send custom email anywhere before or after some action in your store. I’ll show you how to use PrestaShop function to send mail with your custom attachments and variables.

Works with PrestaShop 1.6 and 1.7.

There is a code you can use in any PHP file of your store if you want to send an email. This is a call to a static function Send of Mail class which has 5 required parameters and 10 optional parameters.
Each line has its own comment with suggested ways of getting the variable.

Attachment (optional)

If you want to add an attachment, start with this (example of adding PDF file):

This can be also array of array (for multiple files).

For other format mime types check: https://www.sitepoint.com/mime-types-complete-list/

Send an email

Mail template

Just open and edit 2 specified files (my_mail_template.txt, my_mail_template.html) and style it as you want to! Rembemer you can use your variables {your_email_variable} {another_mail_variable}.

Thanks for reading 🙂

Add a comment

Leave a comment

Your email address will not be published.