Here
is a sample of how we use ColdFusion to add our users. It's
called from our signup form. This code is not complete. It's only
the Imail code. We also check the user name against our RADIUS database at
the same time.
<!-- Mail Test Here
-->
<-- DEFINE SOME VARIABLES -->
<-- DEFINE SOME VARIABLES -->
<cfset
username="#u_name#">
<cfset fullname="#F_Name# #L_Name#">
<cfset password="#Password#">
<cfset fullname="#F_Name# #L_Name#">
<cfset password="#Password#">
<-- CREATE A TEMP FILE NAME TO CATCH OUTPUT OF ADDUSER COMMAND
-->
<cfoutput>
<cfset filename=#Month(Now())# & #Day(Now())# & #Hour(Now())# & #Minute(Now())# & #Second(Now())# & ".TXT">
</cfoutput>
<cfset filename=#Month(Now())# & #Day(Now())# & #Hour(Now())# & #Minute(Now())# & #Second(Now())# & ".TXT">
</cfoutput>
<-- EXECUTE ADDUSER ADN COLLECT IT'S OUTPUT -->
<CFEXECUTE
NAME="C:\imail\adduser.exe"
ARGUMENTS="-u #username# -h martek.net -n ""#fullname#"" -p #password#"
OUTPUTFILE="C:\inetpub\wwwroot\signup\#filename#"
TIMEOUT="1">
</CFEXECUTE>
ARGUMENTS="-u #username# -h martek.net -n ""#fullname#"" -p #password#"
OUTPUTFILE="C:\inetpub\wwwroot\signup\#filename#"
TIMEOUT="1">
</CFEXECUTE>
<-- READ THE FILE INTO A VARIABLE
-->
<CFFILE ACTION="Read"
FILE="c:\inetpub\wwwroot\signup\#filename#"
VARIABLE="Message">
<CFFILE ACTION="Read"
FILE="c:\inetpub\wwwroot\signup\#filename#"
VARIABLE="Message">
<-- TEST FOR SUCCESS
-->
<CFIF #left(Message,3)# eq "OK:">
<cfoutput>
<!-- SUCCESS<br>
Result Code is: #mid(Message, 1, 2)#<br>
Description is: #mid(Message, 5, 100)# -->
<CFFILE ACTION="Delete" FILE="c:\inetpub\wwwroot\signup\#filename#">
</cfoutput>
<CFELSE>
<!-- NOT SUCCESSFUL<br>
Result Code is: #mid(Message, 1, 3)#<br>
Description is: #mid(Message, 5, 100)# -->
<CFIF #left(Message,3)# eq "OK:">
<cfoutput>
<!-- SUCCESS<br>
Result Code is: #mid(Message, 1, 2)#<br>
Description is: #mid(Message, 5, 100)# -->
<CFFILE ACTION="Delete" FILE="c:\inetpub\wwwroot\signup\#filename#">
</cfoutput>
<CFELSE>
<!-- NOT SUCCESSFUL<br>
Result Code is: #mid(Message, 1, 3)#<br>
Description is: #mid(Message, 5, 100)# -->
<cfoutput query
= "chkDupe">
<div align=center>
<p>
<h1>Duplicate User Name Found!</h1>
<p>
We are sorry but the user name (M), <strong>#u_name#</strong>, has already been taken by another user.<br>
Please hit your back button and try again.
</div>
</cfoutput>
<div align=center>
<p>
<h1>Duplicate User Name Found!</h1>
<p>
We are sorry but the user name (M), <strong>#u_name#</strong>, has already been taken by another user.<br>
Please hit your back button and try again.
</div>
</cfoutput>
<-- CLEANUP TEMPORARY FILE
-->
<cfoutput>
<CFFILE ACTION="Delete" FILE="c:\inetpub\wwwroot\signup\#filename#">
<cfabort>
</cfoutput>
</CFIF>
<!-- END OF EMAIL PROCESSING -->
<cfoutput>
<CFFILE ACTION="Delete" FILE="c:\inetpub\wwwroot\signup\#filename#">
<cfabort>
</cfoutput>
</CFIF>
<!-- END OF EMAIL PROCESSING -->
<!-- CHARGE USER'S CREDIT CARD
-->
<!-- THIS IS WHERE WE US AUTHORIZE.NET TO CHARGE THE
USERS CREDIT CARD. SORRY, CAN'T SHOW YOU THIS CODE! :-)
-->
<cfif cfa.response_code eq
1>
Credit card
approved!
<cfelseif cfa.response_code eq 2>
<cfelseif cfa.response_code eq 2>
<--
IF CREDIT CARD IS DECLINED, REMOVE THE USER FROM IMAIL USING ADDUSER WITH THE
-KILL OPTION -->
This credit card was declined
for the following reason:
<cfoutput>#cfa.response_reason_text#</cfoutput>
<CFEXECUTE NAME="C:\imail\adduser.exe"
ARGUMENTS="-u #username# -h martek.net -kill"
OUTPUTFILE="C:\inetpub\wwwroot\signup\killed.txt"
TIMEOUT="1">
</CFEXECUTE>
<cfabort>
<cfelse>
<CFEXECUTE NAME="C:\imail\adduser.exe"
ARGUMENTS="-u #username# -h martek.net -kill"
OUTPUTFILE="C:\inetpub\wwwroot\signup\killed.txt"
TIMEOUT="1">
</CFEXECUTE>
<cfabort>
<cfelse>
An error occured while
processing your credit card. Error:
<cfoutput>#cfa.response_reason_text#</cfoutput>
<CFEXECUTE NAME="C:\imail\adduser.exe"
ARGUMENTS="-u #username# -h martek.net -kill"
OUTPUTFILE="C:\inetpub\wwwroot\signup\killed.txt"
TIMEOUT="1">
</CFEXECUTE>
<cfabort>
</cfif>
<!-- END OF CREDIT CARD PROCESSING -->
<CFEXECUTE NAME="C:\imail\adduser.exe"
ARGUMENTS="-u #username# -h martek.net -kill"
OUTPUTFILE="C:\inetpub\wwwroot\signup\killed.txt"
TIMEOUT="1">
</CFEXECUTE>
<cfabort>
</cfif>
<!-- END OF CREDIT CARD PROCESSING -->
Thanks,
Evans
Martin
-----Original Message-----I have set something up using cold fusion to do this. Basically, Imail has a feature that you can send emails to setup a new email address through a program alias (adduser.exe?). In this email, you include the email prefix (without the domain info), and the password and the users name.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of kaigler
Sent: Monday, September 10, 2001 5:44 PM
To: [EMAIL PROTECTED]
Subject: Re: [IMail Forum] ASP administration
When I send the email I add the record to my database. The next time a user makes the request, I make sure the name has not been taken. If it has not I then send the email to the server to set the new email up.
Occasionally, I will have an email that was not setup. I am not sure what causes this. I have a batch job that runs once a week and re issues the command to create the email for those emails requested during that week. If the email already existed it does nothing, otherwise it adds the email to imail. I have not had any emails not created after running this second job.
if you need more information send me an email directly and I can answer more questions.
kaigler
At 06:18 PM 9/10/2001 -0700, you wrote:
I am looking to do the same thing, any ideas?
- ----- Original Message -----
- From: Matthew Bates
- To: [EMAIL PROTECTED]
- Sent: Monday, September 10, 2001 2:17 PM
- Subject: [IMail Forum] ASP administration
- Hey hi,
- I would like to be able to administrate IMail Server via some form of ASP/CGI application, since I would like to be able to create POP accounts on-the-fly (as part of a membership signup system) for the members.
- Is this at all possible?
- Thanks in advance,
- Matthew Bates
