How to remove * | MC_PREVIEW_TEXT | * from email name using Mailchimp and or Mandrill

I created an email template that includes mail merge tags in MailChimp, which is then published to Mandrill.

When my script runs and I receive an email, as you can see, | MC_PREVIEW_TEXT | appears in the title.

image

I searched Mandrill and MailChimp for this tag, but not displayed in any template file.

How to remove this from email?

+11
source share
9 answers

I had the same problem, and that was because I use Handlebars as a merge when sending emails.

Mailchimp places the MC_PREVIEW_TEXT variable in the template using the Mailchimp merge language, so if you use Handlebars, it appears.

To fix this, you should set your Merge Language to Handlebars in the Mandrill settings β†’ Send by default.

But when you do this, you must use the Mailchimp merge language when designing your letters in Mailchimp, you cannot use Handlebars.

Then, when you send Mandrill from Mailchimp, it will convert all your merge variables to Handlebars.

+7
source

I did this through the Mandrill template editor. enter image description here

Just delete these lines that appear immediately after opening the body:

<!--*|IF:MC_PREVIEW_TEXT|*--> <!--[if !gte mso 9]><!----><span class="mcnPreviewText" style="display:none; font-size:0px; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden; visibility:hidden; mso-hide:all;">*|MC_PREVIEW_TEXT|*</span> <!--<![endif]--> <!--*|END:IF|*--> 

To learn more about this merge tag:
https://kb.mailchimp.com/merge-tags/all-the-merge-tags-cheat-sheet

Use this join tag to create preview text in a custom code campaign. Paste | MC_PREVIEW_TEXT | right after the opening <body> tag in your HTML. To prevent the preview text from being visible in the body of your campaign, wrap the merge tag in a hidden <span> element.

Find or add <style type = "text / css"> </script> in your HTML code and add this code to the "style type" value:

After the opening <body> tag, add: enter image description here

+6
source

We use two approaches:

The last thing I checked, the MC_PREVIEW_TEXT tag will appear every time you submit Mailchimp templates to Mandrill. Choose what is best for you and stick with Mandrill to change Handlebars patterns in the future.

+4
source

We had the same problem with the Mailchimp template editor to send templates to Mandrill. There was also a problem adding https:// to the handlebars tag with the Mailchimp template editor, which forced us to remove https:// from the URL in the payload. Therefore, to fix MC_PREVIEW_TEXT and fix the URL problem, I created the Firefox extension.

https://addons.mozilla.org/en-US/firefox/addon/mandrillchimp/

The only thing you need to do is create a β€œspecial” Mandrill API key that will allow the extension to receive and update the template (information and update rights).

+1
source

open the HTML file and then |MC_PREVIEW_TEXT| ctrl+f , then use |MC_PREVIEW_TEXT| search and replace your text instead

+1
source

We had the same problem, so I wrote a simple rake task for our ROR application that removes | MC_PREVIEW_TEXT | section from Mandrill templates automatically. Here is an example of my rake:

 require 'mandrill' namespace :mandrill do desc 'Removes *|MC_PREVIEW_TEXT|* section for all email templates in mandrill app' task remove_mc_preview_text: :environment do # Templates with handlebars merge language templates = [ 'template-example-1', 'template-example-2', ] mandrill = Mandrill::API.new 'YOUR_API_KEY' templates.each do |name| begin puts "Processing the template: #{name}" # Get the information for an existing template result = mandrill.templates.info name # Finds the section with MC_PREVIEW_TEXT inside a template and substitutes it to the empty string code = result['code'].sub(/\<\!\-\-\*\|IF:MC_PREVIEW_TEXT[[:ascii:]]+END:IF\|\*\-\-\>/m, '') # If nil is provided for any fields, the values will remain unchanged. from_email = nil from_name = nil subject = nil text = nil labels = nil # Set to false to update the draft version of the template without publishing publish = true # Update the code for an existing template mandrill.templates.update name, from_email, from_name, subject, code, text, publish, labels puts "Successfully deleted *|MC_PREVIEW_TEXT|* section from the template: #{name}" rescue Mandrill::Error => e # Mandrill errors are thrown as exceptions puts "A mandrill error occurred: #{e.class} - #{e.message}" end end puts 'Done!' end end 

To do this, you need to take several steps:

  1. Install the Mandrill API client as gem : gem install mandrill-api or add to your Gemfile: gem 'mandrill-api'
  2. Create any rake task (e.g. remove_mc_preview_text.rake) with the code above, inside the lib / tasks / folder
  3. Change YOUR_API_KEY to your real Mandrill API Key
  4. Change the templates names to the templates array to your real templates, if for some reason you do not know them, you can find them here https://mandrillapp.com/templates

And finally, run this command in the root folder of your rails application:

 bundle exec rake mandrill:remove_mc_preview_text 

If you use any other programming language, you can write a similar script using the my example, see the "Mandrill API Clients for Different Programming Languages" section .

+1
source

The preliminary text of the preliminary text to be displayed upon completion. From experience I have seen merge marks appear in tests. You can do two things:

  • Add text to data file for preview text. In principle, it will be the same for all or
  • You can add it to the template in MailChimp.

How to change the preliminary title: change of preliminary title

Greetings

0
source

This may help some of you who are wondering how to do this.

I had a problem exporting an HTML template from MailChimp to Intercom.

Line numbers may vary, so copy the HTML into notepad / text editing and search for | MC_PREVIEW_TEXT | find him

Video with instructions .

0
source

Remove the following lines from your HTML:

  <span class="m_-63420320203924518mcnPreviewText" style="display:none;font-size:0px;line-height:0px;max-height:0px;max-width:0px;opacity:0;overflow:hidden">*|MC_PREVIEW_TEXT|*</span> 

After that, insert your HTML code into the body of the message.
Now your problem should be resolved ....

0
source

Source: https://habr.com/ru/post/1270127/


All Articles