Page 1 of 1

search email address in a lookup file

Posted: 01 Aug 2017 04:46
by 1tamad
Hi,

I am trying to create a whitelist file containing email address. I am trying to put condition to check if the email exist. Somehow it is not working. I suspect that this is because of the special character "@". With normal characters (letters and numbers) it is working. I used the following

indexOf("/storage/emulated/0/email_whitelist.txt",{k9_from})<=0

also will this work as well?

matches)("/storage/emulated/0/email_whitelist.txt",{k9_from})

Thanks

Re: search email address in a lookup file

Posted: 01 Aug 2017 06:09
by Desmanto
First, you have to use action Init Variable Text file, from the /storage/emulated/0/email_whitelist.txt, save it to a variable {file_text}.

Then you can use indexOf() to search the email
indexOf(file_text, {k9_from})<=0

Matches() will use regex, need to add the regex syntax, which is not needed in this case.

For saving the supporting files, i would prefer keep it in the same folder with automagic. Beside not cluttering the root folder of the /sdcard/, it also make it easier to backup or move it all to another phone. I keep mine at /sdcard/Automagic/Resources/. Have been doing the same since using tasker before.

Re: search email address in a lookup file

Posted: 04 Aug 2017 01:16
by 1tamad
Thanks dude