Outlook email variable giving "Object reference not set to an instance of an object" error

HI All

“email” is a MailMessage variable in a for loop of MailMessages. Below is an expression inside the for loop. Not sure how but sometimes this expression is throwing “Object reference not set to an instance of an object” error.

email.Sender.Address.SubString(email.Sender.Address.IndexOf(“@”))

If the MailMessages list is blank the for loop should not execute. Its looping means email is an MailMessage object. Then why the below expression is throwing that particular error ?

@Palaniyappan @lakshman @supermanPunch

1 Like

Hey @kkpatel

Check you have values in email and sender both please…

Email should have ofcourse… but just do a check pls…

Thanks
#nK

1 Like

Thanks @Nithinkrishna.

I found the root cause of this.

Actually there was an Undeliverable email notification in the mail chain with the same subject line. Bot can not read property of that kind of email and throws the above error.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.