Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit on size of Mailchimps merge tag

Tags:

mailchimp

I am using MailChimp to send out bulk emails. I am using merge tags to do it. Problem is I am unable to add more than 255 characters to a tag. Any work around this?

like image 332
user2899644 Avatar asked Apr 19 '16 09:04

user2899644


2 Answers

There's no work-around for that limit, no. Typically if you're wanting to put a bunch of text in those merge fields, what you really want is to send a transactional email or, alternately, you want an email template with some conditional logic based on a much shorter value.

like image 130
TooMuchPete Avatar answered Dec 30 '22 22:12

TooMuchPete


As workaround, you can split large text to 255 character chunks. For example, in java it will looks like:

public static String[] splitString(String code, int len) {
    String[] res = new String[(int)Math.ceil((double)code.length()/len)];
    for(int i = 0; i<res.length; i++){
        res[i] = code.substring(i*len, Math.min(code.length(), (i+1)*len));
    }
    return res;
}

After this create merge fields with type 'text' and name FIELD0, FIELD1, etc, and fill it

String[] parts = splitString(code, 255);
for(int i = 0; i< parts.length; i++) {
    fields.setAdditionalProperty("FIELD"+i, parts[i]);
}
like image 33
user1516873 Avatar answered Dec 30 '22 20:12

user1516873