API Questions on Kentico API.
Version 5.x > API > retrieve SMTP information in a user control View modes: 
User avatar
Member
Member
mj-y - 8/25/2013 4:08:36 AM
   
retrieve SMTP information in a user control
Hi
I use the code below to send email in a user control and it works fine.
EmailMessage email = new EmailMessage();
email.From = "test@afpco.ir";
email.Recipients = ValidationHelper.GetString("mj.yazdani1988@gmail.com", "mj.yazdani1988@gmail.com");
email.Subject = "Subject";
email.Body = "Body of the email";
EmailSender.SendEmail(email);


the " email.From " is the email that I registered in cmssitemanager>settings>emails>SMTP server user.
It would be change after site upload. how can I get "SMTP server user" from site setting and replace it with this static email("test@afpco.ir").

User avatar
Kentico Support
Kentico Support
kentico_janh - 8/25/2013 8:19:07 AM
   
RE:retrieve SMTP information in a user control
Hello,

You can use following method instead:

 CMS.SettingsProvider.SettingsKeyProvider.GetStringValue("CMSSMTPServerUser")


Best regards,
Jan Hermann