Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Changing the SendFrom Email address for data-driven subs Expand / Collapse
Author
Message
Posted Thursday, December 13, 2007 9:57 AM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Friday, April 25, 2014 1:07 AM
Points: 699, Visits: 479
I have recently setup my first data driven subscription without a hitch

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 ???



Post #432955
Posted Tuesday, February 19, 2013 9:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 4, 2013 1:53 PM
Points: 3, Visits: 53
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!!!



Post #1421709
Posted Tuesday, February 19, 2013 11:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 4, 2013 1:53 PM
Points: 3, Visits: 53
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.



Post #1421798
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse