Magento and mandrill smtp headers - magento2

I am using Mandrill as a SMTP.
It is successfully connected to Magento 2.
My question :
Is it possible to use Mandrill's custom header references through Magento Email Templates.
For example, I have created custom templates in Mandrill that can be called upon by a customized field in the email header.
Usually it can be added the same way as the reply-to field.
I want to use the following functionality below:
https://mandrill.zendesk.com/hc/en-us/articles/205582117-How-to-Use-SMTP-Headers-to-Customize-Your-M...
Can I add in the header template :
<?php
$headers = $this->getHeaders();
$headers->addTextHeader('X-MC-Template', 'template_name');
?>
Any guidance would be greatly appreciated.
Thanks

You can create your own plugin for Magento (as it was done in the mageplaza/magento-2-smtp extension, they have shared their experience here) that will help you to rewrite the send mail function sendMessage () through the aroundSendMessage () function. In this case you can write headers on your own depend on the message.
How to create a plugin for Magento 2 you can find at Magento official documentation: https://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

Related

How to use default lightning email template in salesforce

I am calling Salesforce classic email template through URL :
/_ui/core/email/author/EmailAuthor
I have tried to create a lightning component for email where I created the email functionality But that doesn't fit my requirement.
I need to use the default lightning email template and call it from  URL or VF page or any other method. URL hack is not working here so is there any way to do so.

Magento 2 Email Showing template hints

I'm in production mode and a custom module is sending the template hints. Here is an example of a template hint above a block:
/var/www/html/website.com/vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml
Here is the line of code to send the email:
$this->shipmentSender->send($shipment);
Other modules use essentially the same code to send notifications and don't have this problem.
Firstly I used $state->setAreaCode('frontend');, but email template has debug hints. After this I used $state->setAreaCode('global'); and email tamplate hasn't debug hints.
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('global');
$this->shipmentSender->send($shipment);
I try this on Magento 220

Zend mail adding double subject in the header

While implementing the Zend Mail for the Concrete5 CMS. We are getting the double subject in the header of the email. Which is blocking it over the yahoo mail.
All other mail servers are working but yahoo mail rejects the email.
I found these URLs
https://github.com/concrete5/concrete5/issues/5737
https://github.com/zendframework/zend-mail/issues/22
But the solution provided is not working.
It looks like the answer is to use only:
$mail->setSubject('My subject')
instead of:
$mail->addHeader('Subject', 'My subject')
That is, do not explicitly add the subject header; allow ZF to do it.
Is that not possible in your case?

I use magento 2, when submit contact form then issue on mail

I use magento 2, when submit contact form then issue on mail, when receive successfully but problem is apostrophe character.
Suppose any Customer write comment like: Can't able to login then in mail
display like: Can &#039 ; t able to login
I use 4-5 latest version all version this common issue,
Please help to resolve if you know
Go to this path "/vendor/magento/module-contact/view/adminhtml/email" and open "submitted_form.html" and replace 19th line code with the below-mentioned code
{{trans "Comment: %comment" comment=$data.comment|raw}}
Adding to the comment of Abhinav Kumar Singh, there's another way for those who are working with copies of the default e-mail templates in admin backend: MARKETING > COMMUNICATIONS > E-MAIL TEMPLATES.
No need to override original Magento files.
After you have imported the Contact-Form Template, you will find the same syntax in the Template Content field. Just add the "|raw" tag there.
{{trans "Comment: %comment" comment=$data.comment|raw}}
or
{{var data.comment|raw}}

Adding "web version link" in email by sendgrid

How do I add a link to a web version of my sendgrid emails like "having trouble reading this email, click here"?
[EDIT]
I use a php sendgrid library
include "sendgrid-php-master/SendGrid_loader.php";
And I use this code and it doesn't work :
$mail = new SendGrid\Mail();
....
$mail->setHtml('View this email in your browser<br />'.$sg_html_code);
...
Just to confirm what Lirianna said, here you have the answer from Sendgrid support team to the same question:
Using [Weblink] will only be supported when using our Marketing Campaigns tool. To use this in a transactional template, you would need to create and host that link yourself.
Please be aware that SendGrid terminated the [weblink] and [unsubsribe] in 2017 (30/09/2017). You need to migrate with the new migrating toolkit.
Read more from SendGrid here
It's the latter half of 2021 and I tried using {{Weblink}} (capitalisation important) and it works just fine for me using the Dynamic Templates option.. YMMV
As per the official SendGrid documentation {{Weblink}} is available.
Refer: SendGrid docmentation link