Page 1 of 1

How to send a PDF of report to predefined email?

Posted: Tue Dec 11, 2012 8:14 pm
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

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

Posted: Wed Dec 12, 2012 6:04 am
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.

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

Posted: Wed Dec 12, 2012 6:56 am
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

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

Posted: Wed Dec 12, 2012 7:59 am
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.