combit List & Label 27 - .NET Help
Programming Introduction / Examples / General / Sending E-Mail
In This Topic
    Sending E-Mail
    In This Topic

    Sending e-Mail can also be controlled via the list of export options (see section Export Without User Interaction) if export and sending should be done in one step. An example showing that is the Export sample that can be found under "Other” in the .NET sample area in the start menu.

    However, independent of the previous export, it is also possible to send any files via e-Mail by using the MailJob class. This is especially interesting when generating a PDF file from the preview file as a source (see section Join and Convert Preview Files) and the PDF file is supposed to be sent via e-mail.

    // Instantiate mail job
    MailJob mailJob = new MailJob();
    
    // Set options
    mailJob.AttachmentList.Add(@"<Path>\report.pdf");
    mailJob.To = "info@combit.net";
    mailJob.Subject = "Here is the report";
    mailJob.Body = "Please note the attachment.";
    mailJob.Provider = "XMAPI";
    mailJob.ShowDialog = true;
    
    // Send e-Mail
    mailJob.Send();
    mailJob.Dispose();
    
    ' Instantiate mail job
    Dim mailJob As New MailJob()
    
    ' Set options
    mailJob.AttachmentList.Add("<Path>\report.pdf")
    mailJob.To = "info@combit.net"
    mailJob.Subject = " Here is the report "
    mailJob.Body = " Please note the attachment."
    mailJob.Provider = "XMAPI"
    mailJob.ShowDialog = True
    
    ' Send e-Mail
    mailJob.Send()
    mailJob.Dispose()