I am writing a program to read through the email log and give some human readable info.
Where can I find out what these errors are and what they translate to.
It seems we haven't done a very good job of documenting those codes. Unfortunately, the email operation is made up of several sub-operations, each of which has a similar set of generic error codes (0=success, anything else is an error). By the time we get to the point of outputting the log, it's not clear how many of those sub-operations were successful before the error occurred. That probably could use some additional work. But here's a start:
0 : success
-1 : licensing failure, or
invalid header (Subject, From, etc.), or
error adding the message body
-2 : invalid To, CC, or BCC address, or
error adding the attachment file, or
error in the final Send operation
-3 : internal error allocating memory, or
while closing the SMTP connection
-4 : failed to create the email class object.
I have to admit that's not very helpful. But somewhat more helpful (although difficult to integrate into your automated tool perhaps) is the fact that additional details for any errors are also logged to the ashlog.log file. For example...
24-Aug-18 10:03:36 [JACKT450:03-1]<PRINT:3371> PDFX:ASHNET Op: 15, Err -2 (Log:
SendEmail:
DllDate: Oct 28 2016
ChilkatVersion: 9.5.0.63
UnlockPrefix: MICROSMAILQ
Architecture: Little Endian; 32-bit
Language: Visual C++ 10.0 (32-bit)
VerboseLogging: 0
sendEmailInner:
renderToMime:
createEmailForSending:
xSigningAlg: sha1
Auto-generating Message-ID
--createEmailForSending
renderToMime: Elapsed time: 0 millisec
--renderToMime
sendMimeInner:
ensureSmtpSession:M)
That's probably both too much information (which is why we didn't include it in the email LogFile, where brevity and consistency seemed to be the most important attributes). And also probably not enough to really understand the problem either.
But it does contain an indicator of which of the sub-operations (Op: 15, right at the start of the message) failed. The op codes are:
1) Initial setup (licensing, allocation, etc.)
2) Add Subject
3) Add From
4) Add To
5) Add CC
6) Add BCC
7) Add message body
8) Add attachment
9) Add X-Mailer header
10) Add additional app-supplied headers
15) Send it
Most of the errors are going to occur during the first step (connection or authorization errors) or the last step. Although you might also get an error during steps 4-6 if you have an invalid address.