Trying to build a process that will attach incoming mail to a contact even though the incoming email address might be slightly different from what we hold in the database. It seems to partly work
IF INDEX_OF('<',IncomingEmail.FromAddress)=0 THEN FIND Contacts WHERE Contacts.EmailAddress=IncomingEmail.FromAddress
ELSE
FIND Contacts WHERE Contacts.EmailAddress=SUBSTRING(IncomingEmail.FromAddress,INDEX_OF('<',IncomingEmail.FromAddress)+1,INDEX_OF('>',IncomingEmail.FromAddress)-1)
From the logs - part 1 works. 16 =0 so the test fails and the ELSE section is processed. Then I hit a snag because the AwareIM Viewer reports:
"ERROR Notification#IncomingEmail -Exception while processing notification IncomingEmail Message Internal error. Element SUBSTRING in query condition Contacts.EmailAddress=SUBSTRING(IncomingEmail.FromAddress,INDEX_OF('<',IncomingEmail.FromAddress)+1,INDEX_OF('>',IncomingEmail.FromAddress)-1) of query FIND Contacts WHERE Contacts.EmailAddress=SUBSTRING(IncomingEmail.FromAddress,INDEX_OF('<',IncomingEmail.FromAddress)+1,INDEX_OF('>',IncomingEmail.FromAddress)-1) cannot be converted to the currently installed version of SQL"
Seems strange that part one returns (the correct) integer but part two won't insert integers into the substring function. Can anyone shed any ligt on this.
Database is MySQL V5.1.6 community