When defining the template used to send error mail you have the following macroes available to use:
{DocumentNumber}
Will insert the Document number from the document if available. Could be the Invoice number or the Order number depending on the document type
{DocumentsId}
Will insert the Document Id of the failed document if available. If it fails before the interchange is disassembled then
{InterchangeInId}
{Timestamp} dd-MM-yyyy HH:mm:ss
{Exception}
{TechnicalDescription}
{PossibleCause}
{PossibleSolution}
{ErrorCode}
{ExceptionCategory}
{DocumentType}
{StakeHolder}
{ReceiverPartnerName}
{SenderPartnerName}
{ReceiverPartnerContact}
{SenderPartnerContact}
{LinkUrl}
{ExceptionMessage}