Page 1 of 1

Sending email with attachment to specific address

Posted: Thu Sep 08, 2016 3:32 pm
by ZlobnyiSerg
I have instance of StiReport. I need open email client with this report as PDF attachment and with specific "To-address" and "Subject" fields.
I know about export services, about Export(report, file, email) method, but it seems there is no way to specify address and subject? Am I wrong?

The second question: how to add custom button to preview window opened with RenderWithWpf() or RenderWithWpfRibbonUI() ?

Re: Sending email with attachment to specific address

Posted: Sat Sep 10, 2016 12:43 pm
by Alex K.
Hello,

You can try to use StiOptions.Engine.GlobalEvents.InvokeSendEMailProcess method. It is called before trying to send email and if you set CallStandardHandler property to false you could implement your own method to send reports.

Code: Select all

StiOptions.Engine.GlobalEvents.SendEMailProcess += new Stimulsoft.Report.Events.StiSendEMailEventHandler(GlobalEvents_SendEMailProcess);
StiReport report = new StiReport();
report.Load(@"d:\Report.mrt");
report.Compile();
report.Render();
report.Show();
.....
private void GlobalEvents_SendEMailProcess(object sender, Stimulsoft.Report.Events.StiSendEMailEventArgs e)
{
    e.CallStandardHandler = false;
    //send email using MAPI or other methods
    //......
}
Thank you.