Hi,
I just found a Bug in the existing standard v19.4 Business Central code in the SendEmailInBackground() procedure of the Report Selections table.
The problem is that when a Purchase Order is sent by email to the Vendor, the ParamString filled in the Job Queue Entry is something like this string in ES version '6|106001|Pedido compra|10000|0||Vendor' and when it reaches this procedure, it has been shortened until it is equal to '0||Vendor', but since it does not coincide exactly with the literal 'Vendor' it spects, the email with the Purchase Order PDF ends up being sent to the Customer's email with the same No. as the Vendor's Order.
You can see the next debugger capture:
Fortunately, I have been able to correctly intercept and modify this string in the OnSendEmailInBackgroundOnAfterGetJobQueueParameters() event, but it is a Bug that should be corrected as soon as possible due to the importance of sending an email to a totally wrong mailbox.