SmtpFinishingJobEventArgsKeepIt Property
Gets or sets whether to put this job in the collections of finished jobs.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public bool KeepIt { get; set; }

Property Value

Type: Boolean
Set to true to add the Job object to JobsSuccessful or JobsFailed collections (depending on whether it's successful or failed job). Set to false to destroy the Job object instead of adding it to any of these collections after this event handler completes.

This property is mainly for jobs of sending individual e-mails rather than for mail merge jobs. With a mail merge job, you can control what happens with the sub-jobs produced during the mail merge process, using AddJob(String, String, EmailAddressCollection, DataTable, Object, Boolean, Boolean) method and its keepProducedJobs parameter.

Still, this property can be used with mail merge too although it's not as required. By default, MailBee retains all the sub-jobs in the mail merge series but you will still not end up with 1000 e-mail messages in memory because for 999 sub-jobs only their index in mail merge table will be preserved. The generated e-mail will be retained only for the last sub-job in the series.

However, if you send millions of e-mails, even that small footprint of a single sub-job (which contains only the index in mail merge table and a few other small fields) may become too large when multiplied by millions. Although you could set keepProducedJobs to false, you won't get any results in JobsFailed and JobsSuccessful collections until the entire mail merge operation finishes. To overcome this, you can selective set KeepIt to true for every, let's say, 100-th data row

to decrease the number of data in JobsFailed and JobsSuccessful collections by 100 times but still get the picture how the sending goes on.

Or, you can simply use false value for keepProducedJobs, do not use JobsFailed and JobsSuccessful collections at all and monitor the progress only with events (like FinishingJob, MessageSent or MessageNotSent).

See Also