Changing the SendFrom Email address for data-driven subs

  • I have recently setup my first data driven subscription without a hitch :w00t:

    However, I now need to be able to change the sent from email address so that it is specific to various clients.

    How do I achieve this ??? :blink:

  • If you want to change it permanently, you can do the following:

    In the rsreportserver.config file (sql drive:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer):

    5) Populate <SMTPServer>x.x.x.x</SMTPServer> with the IP of the machine where you just setup the SMTP server.

    6) Populate <From>you@yourwebserver.com</From>

    7) Change this one to false <SendEmailToUserAlias>False</SendEmailToUserAlias>

    8) Lastly, make sure you setup the domain as a permitted host such as this:

    <PermittedHosts>

    <HostName>yourwebsite.com</HostName>

    </PermittedHosts>

    However, I was looking for a way to dynamically change the EMAIL FROM on each mail.... haven't discovered any yet!!!

  • OK so I am using a hacky solution to this - basically I use a simple powershell script to change the FROM just before my mails go out.

    I run this command:

    powershell.exe -noexit -command "&{C:\ReportServer\ChangeFromEmail.ps1 -ConfigFilePath "C:\ReportServer\rsreportserver.config" -FromEmailAddress changetothis@myserver.ca}"

    which runs to this script:

    Param(

    [string]$ConfigFilePath,

    [string]$FromEmailAddress

    )

    Write-Host "Changing FROM Email to $FromEmailAddress"

    [xml]$config = gc $ConfigFilePath

    $config.SelectSingleNode("//From").InnerText = $FromEmailAddress;

    $config.save($ConfigFilePath)

    Then I change it back when I'm done using the same script, with different parameter.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply