Sending email with attachment to specific address

Stimulsoft Reports.WPF discussion
Post Reply
ZlobnyiSerg
Posts: 1
Joined: Thu Sep 08, 2016 2:21 pm

Sending email with attachment to specific address

Post 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() ?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sending email with attachment to specific address

Post 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.
Post Reply