Attached is an example for some AUTH code. Note that the same code can be used for
smtpauth.cfm and apop.cfm simply by adjusting the AuthUser variable. E.g.:
apop.cfm:
<CFSET AuthUser = form.POPAuthUser>
<CFINCLUDE TEMPLATE="inc_auth_shared.cfm">
smtpauth.cfm:
<CFSET AuthUser = form.SMTPAuthUser>
<CFINCLUDE TEMPLATE="inc_auth_shared.cfm">
The SQL code will probably need to be modified to suit your DB structure. Also note
the commented-out debug code for logging what is going on.
HTH,
-Max
==^=======================================================
This list server is Powered by iMS
"The Swiss Army Knife of Mail Servers"
--------------------------------------
To leave this list please complete the form at
http://www.coolfusion.com/Support/
Need an iMS Developer license? Sign up for a free license here:
http://www.coolfusion.com/Support/
List archives: http://www.mail-archive.com/inFusion-email%40eoscape.com/
Note: You are subscribed as [EMAIL PROTECTED]
==^=======================================================
<!--- This handles "virtual" domains, or any situation where the domain is passed in
user ID. --->
<CFIF Find("@", variables.AuthUser)>
<CFSET UserName = ListFirst(variables.AuthUser, "@")>
<CFSET Domain = ListLast(variables.AuthUser, "@")>
<CFQUERY NAME="GetPswd" DATASOURCE="#variables.DSN#">
SELECT Accounts.Password, Accounts.AccountID
FROM Accounts, DomainAliases
WHERE Accounts.DomainID = DomainAliases.DomainID
AND Accounts.EmailType = 1
AND LOWER(Accounts.UserName) = LOWER('#variables.UserName#')
AND LOWER(DomainAliases.DomainName) =
LOWER('#variables.Domain#')
</CFQUERY>
<!--- This will fall back to IP-based lookup, using the LocalIP variable --->
<CFELSE>
<CFQUERY NAME="GetPswd" DATASOURCE="#variables.DSN#">
SELECT Accounts.Password, Accounts.AccountID
FROM Accounts, Domains, MailHosts
WHERE Accounts.DomainID = Domains.DomainID
AND Domains.HostID = MailHosts.HostID
AND Accounts.EmailType = 1
AND ForceDomainLogin = 0
AND LOWER(Accounts.UserName) = LOWER('#variables.AuthUser#')
AND MailHosts.IPAddress = '#form.LocalIP#'
</CFQUERY>
</CFIF>
<!--- option=debug --->
<CFIF GetPswd.RecordCount EQ 1>
<CFOUTPUT>
<!--- For the POP PASS template so as not to do double work --->
<inSET AuthUserAcctID="#GetPswd.AccountID#">
<!--- <inLog text="AuthUserAcctID='#GetPswd.AccountID#'"> --->
password=#GetPswd.Password#
result=accept
</CFOUTPUT>
<CFELSE>
result=reject
</CFIF>