SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Changing the SendFrom Email address for data-driven subs


Changing the SendFrom Email address for data-driven subs

Author
Message
Knight
Knight
Right there with Babe
Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)Right there with Babe (765 reputation)

Group: General Forum Members
Points: 765 Visits: 535
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



kevinthepure
kevinthepure
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 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!!!



kevinthepure
kevinthepure
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 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.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search