Jump to content
kurungele

SOLVED How add a Mail Template in new module

Recommended Posts

Hello.

Im developping a new module, and I need create mail templates. I did this:

pixeincidencereport/mails/en/new_incidence.html

pixeincidencereport/mails/en/new_incidence.txt

 

And the call is:

	public function sendMail($action){
		Mail::Send((int)(Configuration::get('PS_LANG_DEFAULT')), // defaut language id
        'new_incidence', // email template file to be use
        ' Module Installation', // email subject
        array(
          '{email}' => 'app@pixefora.com',//Configuration::get('PS_SHOP_EMAIL'), // sender email address
          '{message}' => ' has been installed on:'._PS_BASE_URL_.__PS_BASE_URI__ // email content
        ), 
        'web@pixefora.com', // receiver email address 
        NULL, NULL, NULL);
	}

 

But i allways recibe the same error:

Error - dont found the email template : /home/userred/public_html/prestashopruebas/mails/es/new_incidence.txt

 

How can i do this?

THX!!

 

-----SOLVED---------

Only you have to pass the template_diretory in the function:

Mail::Send((int)(Configuration::get('PS_LANG_DEFAULT')), // defaut language id
        'new_incidence', // email template file to be use
        ' Module Installation', // email subject
        array(
          '{email}' => 'app@pixefora.com',//Configuration::get('PS_SHOP_EMAIL'), // sender email address
          '{message}' => ' has been installed on:'._PS_BASE_URL_.__PS_BASE_URI__ // email content
        ), 
        'web@pixefora.com', // receiver email address 
        NULL, NULL, NULL,NULL,NULL,_PS_MODULE_DIR_.$this->name.'/mails/');

 

 

 

 

Edited by kurungele (see edit history)

Share this post


Link to post
Share on other sites

I'm trying the same as you, but it's not working. 

$this->module->getLocalPath() . 'mails/'

Is also not working, and if i try to actually send a mail from a already existing template, it does work! 
Also if i try to send a test mail trough the backoffice with my new made template it does work.

PS1.7.6.1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More