How to send a PDF of report to predefined email?

Stimulsoft Reports.NET discussion
Post Reply
sandikastelic
Posts: 4
Joined: Tue Dec 11, 2012 8:02 pm

How to send a PDF of report to predefined email?

Post by sandikastelic »

Hi!

I am showing a report with this code (don't bother about language, it is Vulcan.NET):
LOCAL ReportDLLName AS STRING
ReportDLLName := cReportsPath+"\"+reportID+".dll"

IF !file(ReportDLLName)
ErrorBox{, "Sorry, report "+reportID+" is not yet prepared!"}:Show()
ELSE
oReport := StiReport{}
oReport := StiReport.GetReportFromAssembly(ReportDLLName, true)
oReport:RegData("Podatki", dDataSet)
oReport:Show()
ENDIF

Now, when user clicks option to send report in PDF format, I want to automatically fill email adress with predefined one, so user will not need to search between contacts or manually type in adress. How can I do this?

Regards,
Sandi
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: How to send a PDF of report to predefined email?

Post by Jan »

Hello,

You can use following code:

Code: Select all

StiOptions.Engine.GlobalEvents.SendEMailProcess += new Stimulsoft.Report.Events.StiSendEMailEventHandler(GlobalEvents_SendEMailProcess);
void GlobalEvents_SendEMailProcess(object sender, Stimulsoft.Report.Events.StiSendEMailEventArgs e)
        {
            e.CallStandardHandler = false;
            //Your code to send report
        }
Thank you.
sandikastelic
Posts: 4
Joined: Tue Dec 11, 2012 8:02 pm

Re: How to send a PDF of report to predefined email?

Post by sandikastelic »

Thank you for an answer, but I am looking for a solution to use sending procedure, which is available in Report Viewer in toolbar. Viewer first asks for report format (PDF, ...), then creates new email with attachment. This is where I need to fill email adress.

Regards,
Sandi
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to send a PDF of report to predefined email?

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

private void GlobalEvents_SendEMailProcess(object sender, Stimulsoft.Report.Events.StiSendEMailEventArgs e)
{
    e.Recipient = "Recipient@mail.com";
}
Thank you.
Post Reply