Declined
Last Updated: 04 Nov 2021 07:26 by ADMIN
Guy
Created on: 27 Oct 2021 10:15
Type: Feature Request
0
Feature Request - Add the ability to allow additional attachments to be sent when a Telerik Report is emailed via "Send Mail" function

Currently there appears to be no functionality available to add additional attachments via the Telerik Reporting Send Mail dialog or programmatically by passing parameters to the Report Viewer using a model.

 

Scenario 1:

- When we email a new Quote, which is a Telerik Report, to a Customer we would like to automatically attach a "New Products Brochure". The brochure is a frequently updated pdf document that would reside on the server.

 

Scenario 2:

- When we email a Customer Invoice, which is a Telerik Report, to a Customer if:

1) It is the 1st Invoice we have sent them for the current Agreement then automatically attach the Agreement related to Invoice - where the Agreement is another Telerik Report.

2) The Customer has an outstanding balance with us then attach a "Customer Statement", which is another Telerik Report, in pdf format.

 

Thanks in advance.

 


1 comment
ADMIN
Neli
Posted on: 04 Nov 2021 07:26

Hello Guy,

I have to mention that this is a custom functionality that is outside the scope of the Telerik Reporting. In our general workflow, it is not expected to add extra attachments and this may be confusing for some of our users. For that reason, I am afraid that I need to decline the request.

You may test the approaches below which can help you during the implementation of each requirement.

For scenario 1, you can add the logic for attach8ing the Brochure in the method for sending the email. For example:

protected override HttpStatusCode SendMailMessage(MailMessage mailMessage)
{
    var message = mailMessage;
    var recipient = message.To[0];

    // Create  the file attachment for this email message.
    Attachment attachment1 = new Attachment(file, MediaTypeNames.Application.Octet);
    // Add time stamp information for the file.
    ContentDisposition disposition = attachment1.ContentDisposition;
    disposition.CreationDate = System.IO.File.GetCreationTime(file);
    disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
    disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
    // Add the file attachment to this email message.

    if (recipient.ToString() == "test@gmail.com")
    {
        message.Attachments.Add(attachment1);
    }
    else
    {
        message.Attachments.Add(attachment2);
    }
. . . 
}

For scenario 2, you may test  implementing your own logic outside of the report viewer:

1. You can have a button that on click will open the report in PDF. The approach is described in Print a report directly at client-side without displaying it in a Viewer KB article.

2. Add another button that will open the form and trigger the send email functionality. You can use the ReportProcessor class to export the report programmatically and send it to the user with custom code. We provide details and examples for the same in the following resources:


Regards,
Neli
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.