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?
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.
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]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With