We have a Web.config file with the following system.net mailSettings attribute:
<system.net>
<mailSettings>
<smtp configSource="mailSettings.config" />
</mailSettings>
</system.net>
We want to replace this line in the web config: <smtp configSource="mailSettings.config" />
with a pipeline variable whose value will be <smtp from="reports@companyxyz.com" deliveryMethod="Network"> <network enableSsl="true" host="smtp.sendgrid.net" port="587" userName="apiKey" password="12346576fgb" /> </smtp>
.
Also because the developer doesn't want to change the web config file to accommodate prefixes and suffices required by the Replace Tokens task, we want to use custom Token Prefix, as such: <mailSettings>
and Suffix: </mailSettings>
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens@4
displayName: 'Replace tokens in **/*.config'
inputs:
tokenPattern: custom
tokenPrefix: '<mailSettings>'
tokenSuffix: '</mailSettings>'
Can the above be accomplished? Also do I place this Replace Tokens task before Azure App Deploy task? or after?