I’m building a process to go through all my gmail emails, and if the from and sender addresses contain the word “plus” it should move the email to specific folder.
The condition I am using in the if statement is the following:
item.From.Address.Contains(“plus”.Trim.ToUpper) or item.From.Address.Contains(“plus”.Trim.ToLower) or item.Sender.Address.Contains(“plus”.Trim.ToUpper) or item.Sender.Address.Contains(“plus”.Trim.ToLower)
The thing is that when I run the process at one point I get the “object reference not set to an instance of an object” error. I don’t understand why though. I checked the values of item in debugging mode, and sender address is null when the error is thrown but shouldn’t the if statement deal with it?
Does somebody know exactly how the execution of multiple condition if statement like mine works?