Skip to content
Report-Designer

Scheduled reports by email

Send report attachments on a schedule and check when each email ran.

Add Smtp and Schedules under ReportServer. Set the SMTP password through the ReportServer__Smtp__Password environment variable. To test without sending mail, set PickupDirectory in Smtp to write .eml files to a folder.

This schedule sends a sales summary and an Excel aging report every Monday.

{
  "ReportServer": {
    "Smtp": {
      "Host": "smtp.office365.com",
      "Port": 587,
      "EnableSsl": true,
      "UserName": "reports@company.com",
      "From": "Reports <reports@company.com>"
    },
    "Schedules": [
      {
        "Name": "Weekly sales summary",
        "Project": "accounting",
        "Report": "sales-summary",
        "Format": "pdf",
        "Every": "Week",
        "DayOfWeek": "Monday",
        "At": "07:00",
        "Parameters": { "FromDate": "{lastWeekStart}", "ToDate": "{lastWeekEnd}" },
        "To": ["accounting@company.com"],
        "Subject": "Sales summary for {lastWeekEnd}",
        "HtmlBody": "<p>Reports for <b>{lastWeekStart}</b> to <b>{lastWeekEnd}</b> are attached.</p>",
        "Attachments": [
          { "Report": "aging", "Format": "xlsx", "Parameters": { "AsOf": "{lastWeekEnd}" } }
        ]
      }
    ]
  }
}

Use Day, Weekday, Week or Month for Every. Weekly schedules take DayOfWeek. Monthly schedules take DayOfMonth, where 31 means the last day. At uses the server’s local time. Date tokens such as {lastWeekEnd} or {today-7} work in parameters, the subject and the body.

Use HtmlBody for HTML and Body for a plain-text version. Add more reports from the same project in Attachments. Each can set its own Format, FileName and Parameters. The server renders all attachments before sending. If one fails, the audit log names the failed report and the email is skipped.

The server records sent and failed runs in the audit log. It keeps the last run across restarts. An existing schedule with a saved last run can run once on startup if a scheduled time passed during downtime. A key with CanRunSchedules can list schedules with GET /api/schedules or run one now with POST /api/schedules/{name}/run.