Mail.headers in if condition stop the robot execution

Can you send a screenshot of your for each loop , properties.

Include System.Net.Mail.MailMessage as the type argument in the For each loop (edit this is in the Properties)

Try the below solution