User Security Email and App Configuration

In addition to security configuration there's also application and behavior configuration for some of the tasks of the security manager. Specifically there are settings for configuring the email server required for email validations and password recovery and the name of the company which is used on the bottom of the email sent.

Configuration settings can be made in YourApp.ini in the foxpro code folder and you can find the following section:

[Usersecuritymanagerprocess]
Datapath=.\
Htmlpagepath=c:\WebConnectionProjects\UserSecurityManager\Web\
Virtualpath=/UserSecurityManager/
Companyname=ACME Products
Cookiename=MyApp
Emailreplyto=noreply@west-wind.com
Emailsender=admin@west-wind.com
Emailsendername=User Administration Manager
AllowUserToDeleteProfile=on

This maps to the underlying class in AppUserSecurity.prg.

*************************************************************
DEFINE CLASS UserSecurityManagerProcessConfig AS wwConfig
*************************************************************

*** Web Connection Settings
cHTMLPagePath = "c:\WebConnectionProjects\UserSecurityManager\Web\"
cDATAPath = ""
cVirtualPath = "/UserSecurityManager/"

*** Mail Server for Confirmations and Recovery
cEmailSenderName = "User Administration Manager"
cEmailSender = "admin@west-wind.com"
cEmailReplyTo = "noreply@west-wind.com"

*** Company name used on emails (bottom)
cCompanyName = "ACME Products"

*** Session Cookie name 
cCookieName = "_USRM"

*** Determines whether the user can delete his or her own profile
lAllowUserToDeleteProfile = .T.

ENDDEFINE

This class is ideally added dynamically to the server at runtime in YourAppMain.prg in the OnInitCompleted() method:

*** Add any SET CLASSLIB or SET PROCEDURE code here
DO AppUserSecurity
ADDPROPERTY(this.oConfig,;
            "oUserSecurityManagerProcess",;
            CREATEOBJECT("UserSecurityManagerProcessConfig"))

Email Server Configuration

You'll notice that the above configuration information doesn't include Email Server configuration - that configuration is managed through the Web Connection [Main] configuration:

[Main]
Debugmode=On
LiveReloadEnabled=On

...

AdminMailserver=localhost
AdminEmail=support@yoursite.com
AdminMailUsername=
AdminMailPassword=
AdminMailUsessl=Off 

By default this points at localhost and you can fill in a valid SMTP email server.

Local SMTP Server for Testing: Try PaperCut

For local development I would recommend using a local Development SMTP Server that acts as a dead-drop for messages. I use PaperCut for this:

This local SMTP server can capture messages and let you easily click on links to click so you can locally test account verification and password recovery email messages.


© West Wind Technologies, 1996-2020 • Updated: 05/11/20
Comment or report problem with topic