Page 1 of 1

K9_subject error

Posted: 04 Nov 2013 16:31
by Kriggi23
Hi all,
If I try the following as a script

global_k9_subj=substring(k9_subject, 0,35);

I run into an error message. Not always but pretty often. Wonder if there is an error in my script or some subjects have "strange" characters.

Regards
Christian

Re: K9_subject error

Posted: 04 Nov 2013 17:50
by Martin
Hi,

What's the error message in the log (menu->Manage->Log)?

Perhaps you get mails with a subject that's shorter than 35 characters. The substring function will throw an exception in this case (StringIndexOutOfBoundsException).
You can either check the length of the string on your own before passing 35 to the function or call the function left which will check the length of the string:
global_k9_subj=left(k9_subject, 35);

Regards,
Martin