I’m working on email automation to extract emails from a particular sender.There will be dynamically changing hyperlink text in the email body for each email.
using the Get IMAP Message Activity to get emails into for each loop.Later, I used the Find matching pattern activity to obtain the linked text.
Pattern - “<u>(.*?)</u>”
while printing the Find matching pattern activity output i getting the error like
“Log Message: Object reference not set to an instance of an object.”
Have you create a variable in Find Matching Patterns activity.
In the properties panel of Find Matching Patterns if you save the output in Result it will stored in the datatype IENumerable(Match) so, in Log message you need to give yourvariable(0).
If you are storing it in First Match you can pass the output variable directly in log message.
Check if the Find matching pattern activity is correctly configured with the right input (email body) and pattern . Make sure the pattern is valid and will actually match the dynamically changing hyperlink text.
Confirm that the Get IMAP Message activity is correctly retrieving emails with the desired content. You may want to inspect the email contents to ensure they contain the expected pattern for the hyperlink text.
Verify that the output variable of the Find matching pattern activity is correctly assigned and defined. Double-check its scope and initialization within the For Each loop to avoid null reference issues.
you should use the for each for the output of the get imap activity and within that use the item as variable and that item.body must be given as the input of the find match pattern activity and the find match pattern activity should be placed within the for each.