K9_subject error

Post your questions and help other users.

Moderator: Martin

Post Reply
Kriggi23
Posts: 21
Joined: 21 Jul 2013 08:38

K9_subject error

Post by Kriggi23 » 04 Nov 2013 16:31

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: K9_subject error

Post by Martin » 04 Nov 2013 17:50

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

Post Reply