Jump to content

How to send email with attachment


Dev D4v3

Recommended Posts

Hello.

I want to send an email with an attachment but i have a weird issue. My mail is sent with the message but not the attachment.

I'm stuck, please help me. Here is my code

include('../config/config.inc.php');
require_once(dirname(__FILE__).'/../init.php');

$file_attachment=array();

$content = file_get_contents(_PS_ROOT_DIR_.'/_leptis/PDF_20121109_2.pdf');
$file_attachment['content'] = $content;
$file_attachment['name'] ='RandomPDF';
$file_attachment['mime'] = 'application/pdf';

Mail::Send((int)(Configuration::get('PS_LANG_DEFAULT')), // defaut language id
'contact', // email template file to be use
'Export auto commandes du xxxxxxx', // email subject
array(
    '{email}' => Configuration::get('PS_SHOP_EMAIL'), // sender email address
    '{message}' => 'This is a test message.', // email content
),
'[email protected]', // receiver email address
null, //Receiver name
Configuration::get('PS_SHOP_EMAIL'), //Sender email
Configuration::get("PS_SHOP_NAME"), // Sender name
$file_attachment, //Attachment
null, //SMTP mode
_PS_MAIL_DIR_, //Mails directory
true //Die after error?
);
Link to comment
Share on other sites

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...