SMTP setting in web.configs
SMTP setting in web.configs
I would like to place my SMTP mail settings into the web.config file. If I do, will the Stimulsoft email report process still work? Are there other things I would need to change to make this work?
Thanks
John W
Thanks
John W
-
- Posts: 6254
- Joined: Tue Mar 20, 2018 5:34 am
Re: SMTP setting in web.configs
Hello,
Could you explain your issue in more details? Also, please clarify which product and version are you use?
Thank you.
Could you explain your issue in more details? Also, please clarify which product and version are you use?
Thank you.
Re: SMTP setting in web.configs
I am using the latest version of Stimulsoft Reports. I currently have the SMTP settings for mailing the reports Z(url, login, password, etc) set in the code for the EmailReport call.
I would like to move those settings to the web.config for ease of future maintenance. For example, the client moves to another SMTP provider. It will simplify those types of changes. I just want to make sure the email process with see the settings in the web.config.
I would like to move those settings to the web.config for ease of future maintenance. For example, the client moves to another SMTP provider. It will simplify those types of changes. I just want to make sure the email process with see the settings in the web.config.
Re: SMTP setting in web.configs
This is an example of how I do it in other applications with SSRS reporting. This code sits in the web.config
Code: Select all
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="xxxxx@xxxxxx.us">
<network host="smtp.xxxxxx.com" password="xxxxxxxxxx" port="25" userName="xxxxxx"/>
</smtp>
</mailSettings>
</system.net>
-
- Posts: 6254
- Joined: Tue Mar 20, 2018 5:34 am
Re: SMTP setting in web.configs
Hello,
It is not supported email via web.config
Please check the following article:
https://www.stimulsoft.com/en/documenta ... _email.htm
Thank you.
It is not supported email via web.config
Please check the following article:
https://www.stimulsoft.com/en/documenta ... _email.htm
Thank you.
Re: SMTP setting in web.configs
That is the way I have it set now. Perhaps a future release could support SMTP settings in the web.config. It makes maintenance easier for reporting applications.
Thanks
John W
Thanks
John W
Re: SMTP setting in web.configs
I decided to experiment. Here is the VB code that reads SMTP settiings from the web.config. For me it helps with post deployment maintenance. If you improve on it -please share the code.
Thanks
John W.
Thanks
John W.
Code: Select all
Place in Web.Config SMTP settings (After system.web section)
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="xxxxxxxo@xxxxxxx.us">
<network
host="smtp.xxxxxx.com"
port="25"
userName="serverxxxxxx"
password="xxxxxxxxx" />
</smtp>
</mailSettings>
</system.net>
*************************************************************
Protected Sub StiWebViewer1_EmailReport(sender As Object, e As StiEmailReportEventArgs) Handles StiWebViewer1.EmailReport
Dim format As StiExportFormat = e.Format
Dim report As StiReport = e.Report
Dim settings As StiExportSettings = e.Settings
Dim options As StiEmailOptions = e.Options
'Read SMTP settings from web.config
Dim section As SmtpSection = CType(ConfigurationManager.GetSection("system.net/mailSettings/smtp"), SmtpSection)
Dim from As String = section.From
Dim host As String = section.Network.Host
Dim port As Integer = section.Network.Port
Dim enableSsl As Boolean = section.Network.EnableSsl
Dim user As String = section.Network.UserName
Dim password As String = section.Network.Password
Try
options.AddressFrom = from
options.Host = host
options.Port = port
options.UserName = user
options.Password = password
options.EnableSsl = False
Catch ex As Exception
Dim strmsg As String = ex.Message
End Try
End Sub]
Re: SMTP setting in web.configs
Hello, John.
We will discuss your request with our team and will let you know about our decision.
Thank you.
Ticket reference: #7215
We will discuss your request with our team and will let you know about our decision.
Thank you.
Ticket reference: #7215
Re: SMTP setting in web.configs
Using the code I provided works. I would think a there must be a cleaner way to implement it.
-
- Posts: 6254
- Joined: Tue Mar 20, 2018 5:34 am
Re: SMTP setting in web.configs
Hello,
Unfortunately, we do not have plans to add it at the current moment. Sorry.
Thank you.
Unfortunately, we do not have plans to add it at the current moment. Sorry.
Thank you.