Prevent SendGrid from replacing <a> tags in Dynamic Templates - sendgrid

I'm using the #sendgrid/mail library to send emails from our app, using a dynamic template. The template is created entirely with custom HTML.
When emails are delivered, any custom code in <a> tags is ignored.
More specifically, SendGrid adds a "data-saferedirecturl" attribute and strips out any other attributes I add.
I've already tried disabling SendGrid click tracking globally, as well as disabling it individually, but neither seems to make any difference.
Anyone know if it's possible to change this behavior, either via the SendGrid dashboard or API settings?

There is a trackingSettings parameter to the send() API call, so you can add something like:
trackingSettings: {
clickTracking: {enable: false}
},

Related

Azure AD B2C using custom HTML to request OTP verification via SendGrid

I'm using Azure AD B2C / IEF Custom Policies. As part of my Password Reset user journey, I want to use SendGrid to handle the email for the OTP / verification code. I also want to use custom HTML templates for the password reset page(s). The Azure docs give a good example for using SendGrid... BUT it uses DisplayControl elements to format the password reset page and it's not immediately obvious how to augment or replace the DisplayControl element to instead use Custom HTML.
Did anyone manage to get this working? Any pointers?
TIA
EDIT: Is it simply a case of adding a LoadUri element to the ContentDefinition that contains the DataUri?
Actually, it turns out that the DisplayControl works fine. It forms part of the HTML that is dynamically generated and injected into the Custom Template HTML ("App" element) by B2C.
Initially I was getting Server 500 errors from B2C, which lead be to believe there was a problem with the approach - but the I found the source of the errors elsewhere and once fixed, the DisplayControl components worked pretty seemlessly

SendGrid Transactional Templates - Address and Unsubscribe Link Broken

I've configured several Transactional Templates to be sent from my SendGrid account via their handy Design Tool, which work great!.
However the Address Line and Unsubscribe links on the template footer aren't activated. In an email they display as placeholders, like so
[Sender_Name]
[Sender_Address], [Sender_City], [Sender_State]
[Sender_Zip]
Unsubscribe << (Not a Hyperlink)
I've followed SendGrid's documentation and configured my account address but am unable to find the solution for this.
Any ideas on this? Thanks for any input or guidance!
To get the unsubscribe to function you will need to create one or more unsubscribe groups. If you look under the Marketing menu you will see the sub menu to create those. Once you create one it will be assigned an ID number. When you are generating your email you will need to pass that ID value in as part of the EmailMessage object. If you are using V3 of the API you will be looking for SetAsm.
As for the Sender fields, for transactional templates they do not work correctly, as they are meant for marketing campaigns. Your two options are:
Remove the Sender fields from that block in the template. Add a new text block above it with static values.
Download the template into HTML and convert the sender objects into substitution variables. You will then be able to set them in your code when you are creating the email.
GitHub Bug
The unsubscribe link will only appear if you create an unsubscribe group and specify it while sending using
asm: {
group_id: <the unsubscribe group ID>
}

How to user Mandrill Handlebars in Java?

We are using Mandrill to send emails. Till now we used only the templates but now we need to use handlebars. We use this Java client But I was not able to make the handlebars functionality work.
I am sending a message using:
MandrillMessageStatus[] statuses = mandrillApi.messages().sendTemplate(key, templateContent, message, false);
Where I should add the map of values to be used by the handle bars?
Thanks
The main problem is that you need to enable Handle bars on Mandrill and they mention it all the way on the bottom of the docs. So if you are the type of people that skim and then get their hands dirty... then just to the bottom part of this to learn how to enable it

CakeEmail Template InPage Css Doesnt Apply

Problem :
In Gmail the email template is not viewed like
http://zurb.com/ink/downloads/templates/basic.html
it looks like a simple plain text mail with html tags, without color formatting
What I Tried :
Template Code Used : http://zurb.com/ink/downloads/templates/basic.html
Copy Pasted in Views\Layouts\Emails\html\default.ctp for a quick check & sent a test mail.
Their Test's says it should work on all major email emails
Test Result : https://litmus.com/pub/85a1b19
That is a nice layout - just not for emails.
For templates HTML emails all style must be inline - style tags are not allowed across many email clients.
Thus, you need to use something like I do to transform the style css into inline css upon sending:
https://github.com/dereuromark/tools/blob/master/Lib/InlineCssLib.php
Basically, upon generating the final template, an afterLayout() hook of a helper can trigger this.
See this discussion for details on the implementation.
Maybe the parameter ->emailFormat('text')?
ensure that you use ->emailFormat('html')

Expression Engine using the Champagne Extension troubleshooting

I have an issue in Expression Engine using the Champagne Extension where it won't allow me to send out campaigns. This extension utilizes https://www.campaignmonitor.com/ api to send out mass emails.
The Error I get is "HTML Content URL Required" when I try to send out campaigns form the back end of the Expression Engine Install.
What could be causing this issue that relates to the expression engine install?
This error is received anytime the URL to your html or text content is not visible. More often this is seen when someone forget to include the text version. A good way to test is to click the preview HTML/TEXT button and make sure both give you the correct results.
They cannot be blank.
For an alternative solution, be sure to checkout my add-on Postmaster. It allows clients to publish email campaigns just by creating a new entry. You can setup any number of configuration, so you can even send draft email to a test subscriber list. And since everything is within channel entries, you can use whatever fieldtypes you like, and it works with MailChimp as well as CampaignMonitor.
https://objectivehtml.com/articles/postmaster-the-definitive-email-solution-for-expressionengine