SendMailJobGetIndicesAsString Method
Returns the string containing comma-separated list of data table row indices yet to be processed as mail merge.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
public string GetIndicesAsString()

Return Value

Type: String
Comma-separated list of data table row indices of a pending mail merge job, index of the data row of the finished job, or "0" string if this job is not a "mail merge over DataTable" job.

For jobs which reside in Smtp.JobsPending collection, GetIndicesAsString 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 GetIndicesAsString for every job in the collection.

Note Note
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.
See Also