Mail template with module fields

Hi,

I use SugarCRM pro 7.6 and I want to send via PHP a mail with a pre-created template.

In the template I want to insert a lot of fields from different modules (Accounts, Contacts, Quotes...).

How can I create the template with the fields placeholders?

How can I parsing the template to insert the values of the fileds in the text of the mail?

I searched a solution on google but I find only this page https://developer.sugarcrm.com/2013/09/25/parsing-an-email-template-programatically/ which doesn't consider fields from different modules.

Thanks for the help

Best regards

Stefano