For jobs which reside in Smtp.JobsPending collection, will usually return "0" for "not a mail merge" jobs (jobs of sending a single message), "x, -1" for mail merge jobs of sending all the rows in the data table (where x is zero initially, and then x will be sequentially incremented as mail merge process comes along), or "y" where y is an index of the data row of the finished mail merge job.
However, mail merge jobs in Smtp.JobsPending can also have arbitrary sets of data row indices to be processed (for instance, "0,4,199,200,501,-1" which means "process rows 0, 4, 199, 200, 501, and the rest of the table", or "5,10,15" which means "process rows 5, 10, and 15"). A mail merge job with arbitrary set of data row indices can be placed into Smtp.JobsPending collection using Smtp.AddJob method overload.
In most cases, to get the results of mail merge (which rows have been processed successfully, which have been failed, etc), the developer should use SendMailJobCollection.GetIndicesAsString method instead. For instance, mailer.JobsFailed.GetIndicesAsString(null) (in C# syntax, assuming mailer is Smtp instance) will return all data row indices for all failed jobs. Thus, there will be no need to manually iterate through JobsFailed and call for every job in the collection.
|For mail merge over IDataReader jobs, this method returns zero. For data readers, 'index' has no meaning. You can't address certain row of a data reader by index, you can just iterate through entire dataset to read through all the rows. Instead, event handlers must be used to track successful and failed sendings,such as in the example for SendMailMerge(String, EmailAddressCollection, IDataReader) topic.|