Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. PasswordRecovery and programmatically setting mailSettings

PasswordRecovery and programmatically setting mailSettings

Scheduled Pinned Locked Moved ASP.NET
csharpsysadmintutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Barry Etter
    wrote on last edited by
    #1

    Hi. Is it possible to set the SMTP settings for the PasswordRecovery control from code rather than having it in the web.config file (in the System.Net -> mailSettings element)? I use the same code for several different applications and I want the e-mails to come from the various application e-mail address rather than just one hard-coded in the web.config file. I would like to set the SMTP server, username, password, etc. in the Page_Load() event, for example. None of the docs or Google hits I found addressed this for the PasswordRecovery control. I found examples of sending generic e-mails, but none address the PasswordRecovery control. Thanks! Barry Etter

    M 1 Reply Last reply
    0
    • B Barry Etter

      Hi. Is it possible to set the SMTP settings for the PasswordRecovery control from code rather than having it in the web.config file (in the System.Net -> mailSettings element)? I use the same code for several different applications and I want the e-mails to come from the various application e-mail address rather than just one hard-coded in the web.config file. I would like to set the SMTP server, username, password, etc. in the Page_Load() event, for example. None of the docs or Google hits I found addressed this for the PasswordRecovery control. I found examples of sending generic e-mails, but none address the PasswordRecovery control. Thanks! Barry Etter

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      I think I see what you mean. You can set a bunch of subproperties of the MailDefinition object in code from Page_Load(), but you can't specify the server. And MailDefinition is read-only, so you can't create a different one. You could always handle emailing the password manually, and construct a MailMessage yourself instead of using the PasswordRecovery's built-in email capability, using an SmtpClient object to send it.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups