Configuration of the Web.Config file

Asked

Viewed 846 times

0

I wonder if I can leave the recipient’s email on web.config, if I can, how to deploy. I created a variable and gave the value of the email, but if I need to change I will have to compile dnv, if I can put the recipient on the web.config and only get the value from there will not need to compile every time the email is changed. Thank you

public void montarEmail(string nome, string email, string celular, string telefone, string assunto, string mensagem)
        {
            var servicoDeEmail = new ServicoDeEmail();

            var destinatario = "[email protected]";



            string corpoDoEmail = "Dados do contato: <br />" +
                                   "<br />" +
                                   "<b>Nome: </b>" + nome + "<br />" +
                                   "<b>Email: </b>" + email + "<br />" +
                                   "<b>Telefone: </b>" + telefone + "<br />" +
                                   "<b>Celular: </b>" + celular + "<br />" +
                                   "<br />" +
                                   "<b>Mensagem: </b>" + mensagem;

            servicoDeEmail.EnviarEmail(destinatario, assunto, corpoDoEmail);

        }

1 answer

2


  • It worked vlw!!! var servicoDeEmail = new Servicodeemail(); var destinatario = Configurationmanager.Appsettings["Emaildestinatario"]; var cc = Configurationmanager.Appsettings["Emailcc"];

  • @Carlosroberto Good! Mark the answer as correct to help other people who have the same question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.