Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 31641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:38:13+00:00 2026-05-10T13:38:13+00:00

I’ve developed my own delivery extension for Reporting Services 2005, to integrate this with

  • 0

I’ve developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution.

It takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and the report attached as XLS.

Everything works fine, until mail delivery…

Here’s my code for sending e-mail:

 public static List<string> SendMail(SubscriptionData data, Stream reportStream, string reportName, string smptServerHostname, int smtpServerPort) {   List<string> failedRecipients = new List<string>();    MailMessage emailMessage = new MailMessage(data.ReplyTo, data.To);   emailMessage.Priority = data.Priority;   emailMessage.Subject = data.Subject;   emailMessage.IsBodyHtml = false;   emailMessage.Body = data.Comment;    if (reportStream != null)   {     Attachment reportAttachment = new Attachment(reportStream, reportName);     emailMessage.Attachments.Add(reportAttachment);     reportStream.Dispose();   }    try   {     SmtpClient smtp = new SmtpClient(smptServerHostname, smtpServerPort);      // Send the MailMessage     smtp.Send(emailMessage);   }   catch (SmtpFailedRecipientsException ex)   {     // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List     failedRecipients.Add(ex.FailedRecipient);   }   catch (SmtpFailedRecipientException ex)   {     // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List     failedRecipients.Add(ex.FailedRecipient);   }   catch (SmtpException ex)   {     throw ex;   }   catch (Exception ex)   {     throw ex;   }    // Return the List of failed recipient e-mail addresses, so the client can maintain its list.   return failedRecipients; } 

Values for SmtpServerHostname is localhost, and port is 25.

I veryfied that I can actually send mail, by using Telnet. And it works.

Here’s the error message I get from SSRS:

ReportingServicesService!notification!4!08/28/2008-11:26:17:: Notification 6ab32b8d-296e-47a2-8d96-09e81222985c completed. Success: False, Status: Exception Message: Failure sending mail. Stacktrace: at MyDeliveryExtension.MailDelivery.SendMail(SubscriptionData data, Stream reportStream, String reportName, String smptServerHostname, Int32 smtpServerPort) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MailDelivery.cs:line 48 at MyDeliveryExtension.MyDelivery.Deliver(Notification notification) in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MyDelivery.cs:line 153, DeliveryExtension: My Delivery, Report: Clicks Development, Attempt 1 ReportingServicesService!dbpolling!4!08/28/2008-11:26:17:: NotificationPolling finished processing item 6ab32b8d-296e-47a2-8d96-09e81222985c

Could this have something to do with Trust/Code Access Security?

My delivery extension is granted full trust in rssrvpolicy.config:

   <CodeGroup      class='UnionCodeGroup'     version='1'     PermissionSetName='FullTrust'     Name='MyDelivery_CodeGroup'     Description='Code group for MyDelivery extension'>     <IMembershipCondition class='UrlMembershipCondition' version='1' Url='C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\MyDeliveryExtension.dll' />    </CodeGroup>  

Could trust be an issue here?

Another theory: SQL Server and SSRS was installed in the security context of Local System. Am I right, or is this service account restricted access to any network resource? Even its own SMTP Server?

I tried changing all SQL Server Services logons to Administrator – but still without any success.

I also tried logging onto the SMTP server in my code, by proviiding: NetworkCredential(‘Administrator’, ‘password’) and also NetworkCredential(‘Administrator’, ‘password’, ‘MyRepServer’)

Can anyone help here, please?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T13:38:14+00:00Added an answer on May 10, 2026 at 1:38 pm

    What’s at:

    at MyDeliveryExtension.MailDelivery.SendMail(SubscriptionData data, Stream reportStream, String reportName, String smptServerHostname, Int32 smtpServerPort)    in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MailDelivery.cs:line 48   at MyDeliveryExtension.MyDelivery.Deliver(Notification notification)    in C:\inetpub\wwwroot\CustomReporting\MyDeliveryExtension\MyDelivery.cs:line 153 

    Also you seem to be disposing the report stream, but that should be done by whatever opened that stream, not your method (it won’t be obvious that attaching a stream disposes it).

    You’re losing part of your stack trace due to how you re-throw exceptions. Don’t throw the ex variable, just throw is enough.

    Try this tweak:

    public static List<string> SendMail(SubscriptionData data, Stream reportStream, string reportName, string smptServerHostname, int smtpServerPort) {   List<string> failedRecipients = new List<string>();    MailMessage emailMessage = new MailMessage(data.ReplyTo, data.To) {       Priority = data.Priority,       Subject = data.Subject,       IsBodyHtml = false,       Body = data.Comment   };    if (reportStream != null)     emailMessage.Attachments.Add(new Attachment(reportStream, reportName));    try   {       SmtpClient smtp = new SmtpClient(smptServerHostname, smtpServerPort);        // Send the MailMessage       smtp.Send(emailMessage);   }   catch (SmtpFailedRecipientsException ex)   {     // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List     failedRecipients.Add(ex.FailedRecipient);      //are you missing a loop here? only one failed address will ever be returned   }   catch (SmtpFailedRecipientException ex)   {     // Delivery failed for the recipient. Add the e-mail address to the failedRecipients List     failedRecipients.Add(ex.FailedRecipient);   }    // Return the List of failed recipient e-mail addresses, so the client can maintain its list.   return failedRecipients; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I know there's a lot of other questions out there that deal with this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.