Hi,
I want to create a string with string.format, but the format must be editable.
Therefor i want to add the format in app.config and read it from the program and enter the correct values in it.
This is my app.config-file:
My code tries to fill in the string like this:
If I run this code, my string "body" still is "Event Reminder\n\Even t : {1} ...." and not {Event Reminder\n\nEve nt : My event ..."
Any way to solve this?
I want to create a string with string.format, but the format must be editable.
Therefor i want to add the format in app.config and read it from the program and enter the correct values in it.
This is my app.config-file:
Code:
<?xml version="1.0" encoding="utf-16" ?>
<configuration>
<appSettings>
<!-- SimpleMailAddin settings -->
<!-- MailSender, SMTPServer and MailBodyFormat are required -->
<add key ="MailSender" value ="me@mydomain.com"/>
<add key ="SMTPServer" value ="VMEXCH.mydomain.com"/>
<!-- This is the foSystermatstring of the body of the message. Usable values : {0} = Event_ID {1} = Event_Name {2} = Event_StartDate {3} = Event_EndDate {4} = Event_Description -->
<add key="MailBodyFormat" value="Event Reminder\n\nEvent : {1} ({0})\nStartdate : {2}\nEnddate : {3}\n\n{4}"/>
</appSettings>
</configuration>
Code:
string body = System.Configuration.ConfigurationManager.AppSettings["MailBodyFormat"]; body = string.format(body, Event_ID, Event_Name, Event_StartDate, Event_EndDate, Event_Description);
Any way to solve this?
Comment