+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Email Distribution With the MailJob Class

net
(combit Team) #1
Valid from List & Label 23
Independently of a previous export, the MailJob class allows you to send any files by email. This is particularly interesting if, for example, a PDF file is generated from a preview file as a source and if it is to be sent later. The 'AdditionalOptions' property allows the setting of additional email options, e. g. for SMTP transmission. These can be viewed in the programmer's reference (see chapter 'Setting Mail Parameters by Code').
// Instantiate Mailjob
MailJob mailJob = new MailJob(); 

// Set options
mailJob.AttachmentList.Add(@"<path>\report.pdf");
mailJob.To = "info@combit.net";
mailJob.Subject = "Here comes the report";
mailJob.Body = "Please have a look at the attachment.";
mailJob.ShowDialog = true;

// Setting SMTP settings using AdditionalOptions
mailJob.Provider = "SMTP";
mailJob.AdditionalOptions.Add("Export.Mail.SMTP.ServerAddress", "<ServerAdress>");
mailJob.AdditionalOptions.Add("Export.Mail.SMTP.ServerUser", "<ServerUser>");
mailJob.AdditionalOptions.Add("Export.Mail.SMTP.ServerPassword","<ServerPassword>");

// Send email
mailJob.Send();
mailJob.Dispose(); 
IDKBTE001341 KBTE001341