LoginName-attribute not shown correctly in email

Discussion created by HeikkiS on Mar 8, 2018
Latest reply on Mar 14, 2018 by HeikkiS

I have a form with field ToUser, which is of sharepoint person type. When I use ToUser.LoginName in email template, it shows the login name in format "i:0#.f|membership|firstname.lastname@mycompany.com", while the correct login name is "firstname.lastname@mycompany.com". See pictures below. How do I get the real UPN in the email message?