Skip to main content
Tweeted twitter.com/StackMagento/status/1304434554967658497
added 3 characters in body; edited tags; edited title
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73

How to add subject in magento2 custom email template?

I have created custom email template in magento2.Mail Mail function is working fine, but subject is not sent in that email.How How can I add the subject in my custom email template.

$transport = $this->transportBuilder
       ->setTemplateIdentifier('my_custom_email_template')
       ->setTemplateOptions(
            [
                'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
            ]
        )
       ->setTemplateVars($vars)
       ->setFrom($sender)
       ->addTo($toEmail)
       ->getTransport();
    $transport->sendMessage();
    $this->inlineTranslation->resume();

How to add subject in magento2 custom email template?

I have created custom email template in magento2.Mail function is working fine but subject is not sent in that email.How can I add the subject in my custom email template.

$transport = $this->transportBuilder
       ->setTemplateIdentifier('my_custom_email_template')
       ->setTemplateOptions(
            [
                'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
            ]
        )
       ->setTemplateVars($vars)
       ->setFrom($sender)
       ->addTo($toEmail)
       ->getTransport();
    $transport->sendMessage();
    $this->inlineTranslation->resume();

How to add subject in custom email template?

I have created custom email template in magento2. Mail function is working fine, but subject is not sent in that email. How can I add the subject in my custom email template.

$transport = $this->transportBuilder
       ->setTemplateIdentifier('my_custom_email_template')
       ->setTemplateOptions(
            [
                'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
            ]
        )
       ->setTemplateVars($vars)
       ->setFrom($sender)
       ->addTo($toEmail)
       ->getTransport();
    $transport->sendMessage();
    $this->inlineTranslation->resume();
Source Link
Jeeva Chezhiyan
  • 1.5k
  • 3
  • 20
  • 39

How to add subject in magento2 custom email template?

I have created custom email template in magento2.Mail function is working fine but subject is not sent in that email.How can I add the subject in my custom email template.

$transport = $this->transportBuilder
       ->setTemplateIdentifier('my_custom_email_template')
       ->setTemplateOptions(
            [
                'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
            ]
        )
       ->setTemplateVars($vars)
       ->setFrom($sender)
       ->addTo($toEmail)
       ->getTransport();
    $transport->sendMessage();
    $this->inlineTranslation->resume();