Hello,
You wouldn't be able to modify the value from an email template you send to customers. The fields on a template are merge fields. You can retrieve the data from the database for the templates, but you can not send data back. What you can do is give the user a link to the portal and have them log in to change the 'Opt out of marketing…' option.
If this is a screen in the portal, the save button at the bottom can save the checkbox value into the IsOptOutOfMarketing field on the contact list.
- Greg