Hi, @Stefan Wehrli
Thank you for posting in Microsoft Q&A forum.
It seems it's difficult to get the computer name and add the computer to the script because the script is running on the other computer.
We may consider to run a script on the computer we are deploying, such as: add a ZTISendmail application as the final step of the task sequence like this article:
https://www.deploymentresearch.com/configure-mdt-2010-to-send-an-email-when-deployment-is-completed/
You may also try this guidance:
https://community.spiceworks.com/how_to/138021-e-mail-notifications-for-mdt
(Please Note: Since the website is not hosted by Microsoft, just for your reference.)
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.