• Tried both suggestions, first @append_query_error = 1, same result. Then changed file name to @query_attachment_filename = NULL and got the error message added twice to sysmail_log after executing the job. I have to say at this point that this is weird.

    And yes you have the scenario correct, except what do you mean by "The sp_send_dbmail returns successfully"? No retries in code. Just those attempted by db mail.

    Thanks very much.