07-26-2023, 08:21 PM
I am developing a module for PrestaShop 1.5.
I am sending email like this(the documentation is really missing, i studied other default components and this is what i got so far)
Mail::Send(
$this->context->language->id, //int $id_lang
'template_name',//string $template
//Mail::l('Hello', $this->context->language->id),//string $subject
$this->l('Email subject'),//string $subject
array('{discount}' => $code,
'{firstname}' => $customer['firstname'],
'{lastname}' => $customer['lastname'],
'{img_url}' => $img_url,
'{valid_days}' => $form['days_valid']
),//string $template_vars
$customer['email'],//string $to
implode(' ', array_filter( array( $customer['firstname'], $customer['lastname']) )),
strval( Configuration::get('PS_SHOP_EMAIL') ),//string $from
strval( Configuration::get('PS_SHOP_NAME') ),//string $from_name
/* null,//string $from
null//string $from_name */
null,//array $file_attachment
null,//$mode_smtp
$template_path//string $template_path /*__PS_BASE_URI__.'modules/'.$this->name.'/mails/' */
);
Note i tried using
Mail::l('Hello', $this->context->language->id),//string $subject
and
$this->l('Email subject'),//string $subject
as the email's subject.
And i keep getting "No Subject was found for ...". What the customer receive is the hardcoded string i put in the source code.
So how to get rid of this error:
![enter image description here][1]
Plus the emails are sent in apparently random language(sometimes english, sometimes italian).
[1]:
I am sending email like this(the documentation is really missing, i studied other default components and this is what i got so far)
Mail::Send(
$this->context->language->id, //int $id_lang
'template_name',//string $template
//Mail::l('Hello', $this->context->language->id),//string $subject
$this->l('Email subject'),//string $subject
array('{discount}' => $code,
'{firstname}' => $customer['firstname'],
'{lastname}' => $customer['lastname'],
'{img_url}' => $img_url,
'{valid_days}' => $form['days_valid']
),//string $template_vars
$customer['email'],//string $to
implode(' ', array_filter( array( $customer['firstname'], $customer['lastname']) )),
strval( Configuration::get('PS_SHOP_EMAIL') ),//string $from
strval( Configuration::get('PS_SHOP_NAME') ),//string $from_name
/* null,//string $from
null//string $from_name */
null,//array $file_attachment
null,//$mode_smtp
$template_path//string $template_path /*__PS_BASE_URI__.'modules/'.$this->name.'/mails/' */
);
Note i tried using
Mail::l('Hello', $this->context->language->id),//string $subject
and
$this->l('Email subject'),//string $subject
as the email's subject.
And i keep getting "No Subject was found for ...". What the customer receive is the hardcoded string i put in the source code.
So how to get rid of this error:
![enter image description here][1]
Plus the emails are sent in apparently random language(sometimes english, sometimes italian).
[1]: