<% '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Module: Sample Signup Page ' ' MailEnable Pty. Ltd. 2002 ' Note: This signup utility requires MailEnable Professional (Web Administration) or MailEnable Enterprise Edition ' Licensing: You are free to change,modify,extend and integrate this code so long as you are ' either evaluating of have purchased MailEnable Professional or Enterprise Editions. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Session("Signup_Postoffice") = "MailEnable" ' Name of the postoffice to which people will be able to sign up Application("MEWebPath")="/MEAdmin" ' Base URL Name of MailEnable Web Alias Session("RedirectURL")="/MEWebMail/base/default/lang/EN/login.asp" ' Web URL to redirect the user to once registered Session("Signup_Skin") = Application("MEWebPath") & "/base/default/skins/default/" ' Name of the skin to which you want to use for the signup page DefaultMailboxQuota=0 ' Set unlimited quota for new mailboxes ReferrerIPs = "" ' This variable is optionally checked (If not blank) to ensure that the user has read your terms and conditions and has been directed from the correct server. List is comma delimited. MsgWelcome = "Welcome to the MailEnable Sign-up Wizard. This wizard allows you to create a mail account that can be accessed over the internet." MsgHeadingTitle = "MailEnable Account Sign-up" %> <% Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires=True Response.ExpiresAbsolute = Now %>
<% ' ' We need to check for a form action before we show the form ' If Request("FormAction") = "Create Account" Then ' We can actually attempt to create the account Dim oLogin ' First we need to determine if the mail account already exists If Len(Request("LoginID")) > 0 And Len(Request("DomainName")) > 0 And Len(Request("Password")) > 0 Then Set oLogin = Server.CreateObject("MEWebAdmin.Login") oLogin.Account = Session("Signup_Postoffice") oLogin.LastAttempt = -1 oLogin.LastSuccessfulLogin = -1 oLogin.LoginAttempts = -1 oLogin.Password = "" oLogin.Rights = "" oLogin.Status = -1 oLogin.UserName = Request("LoginID") & "@" & Session("Signup_Postoffice") If oLogin.GetLogin <> 1 Then oLogin.LastAttempt = 0 oLogin.LastSuccessfulLogin = 0 oLogin.LoginAttempts = 0 oLogin.Password = Request("Password") oLogin.Rights = "USER" oLogin.Status = 1 ' Since the mailbox name is available then we need to create the login If oLogin.AddLogin =1 Then ' ' We added the login - What could go wrong! ' End If Set oLogin = Nothing ' Next we need to create the mailbox itself Dim oMailbox Set oMailbox = Server.CreateObject("MEWebAdmin.Mailbox") oMailbox.Postoffice = Session("Signup_Postoffice") oMailbox.Mailbox = Request("LoginID") oMailbox.RedirectAddress = "" oMailbox.RedirectStatus = 0 oMailbox.Size = 0 oMailbox.Limit = DefaultMailboxQuota oMailbox.Status = 1 If oMailbox.AddMailbox = 1 Then ' ' Mailbox was added - What could go wrong! ' End If Set oMailbox = Nothing ' Finally, we need to assign address map(s) for the mailbox Dim oAddressMap Set oAddressMap = Server.CreateObject("MEWebAdmin.AddressMap") oAddressMap.Account = Session("Signup_Postoffice") oAddressMap.DestinationAddress = "[SF:" & Session("Signup_Postoffice") & "/" & Request("LoginID") & "]" oAddressMap.SourceAddress = "[SMTP:" & Request("LoginID") & "@" & Request("DomainName") & "]" oAddressMap.Scope = 0 If oAddressMap.AddAddressMap = 1 Then ' ' Address Map was added too - What could go wrong! ' End If Set oAddressMap = Nothing Response.Redirect Session("RedirectURL") & "?LoginID=" & Request("LoginID") & "&Postoffice=" & Session("Signup_Postoffice") & "&DomainName=" & Request("DomainName") Response.End Else Prompt = "Invalid Data was passed to this form. Please Re-enter your details to continue." End If Else Prompt = "The mailbox name you specified is not available. Please try another mailbox name." ' We need to inform the user that their mailbox creation failed End If FrmLoginID = Request("LoginID") FrmPassword = Request("Password") FrmConfirmPassword = Request("ConfirmPassword") Else If ReferrerIPs <> "" Then If InStr(1,ReferrerIPs,Request.ServerVariables("REMOTE_ADDR")) <= 0 Then Response.Write "You must accept terms and conditions before you can access this page." Response.End End If End If End If
%> <html> <head> <TITLE>MailEnable</TITLE> <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=iso-8859-1"> <META HTTP-EQUIV="Expires" CONTENT="0"> <META http-equiv="Pragma" content="no-cache"> <META http-equiv="Cache-Control" content="no-cache"> <LINK REL="stylesheet" TYPE="text/css" HREF="<%=Session("Signup_Skin")%>me.css"> </head> <BODY marginheight="0" topmargin="0" rightmargin="0" marginwidth="0" class=ME_MessageHeader> <H2><%=MsgHeadingTitle%></H2> <FORM METHOD="POST" ACTION="signup.asp" name=form1 onsubmit="return ValidateForm(document.f1);"><BR> <CENTER> <TABLE WIDTH="90%" BORDER=0 CELLPADDING=2 CELLSPACING=0> <TR> <TD class="ME_StandardText"> <%=MsgWelcome%> <BR> <BR> Please select the username and domain name for your mailbox.<BR> <BR> <% ' Show any errors if they have been set If len(Prompt) > 0 Then Response.Write "<BR><DIV BGCOLOR=""Yellow"">" & Prompt & "</DIV><BR>" End If %> </TD> </TR> </TABLE> <BR> <CENTER> <TABLE WIDTH=90% BORDER=0> <TR class=ME_List0> <TD WIDTH=150>Domain Name:</TD> <TD> <% Dim SampleDomainName SampleDomainName = "mailenable.com" 'used incase there are no domains specified Set oDomain = Server.CreateObject("MEWebAdmin.Domain") oDomain.AccountName = Session("Signup_Postoffice") oDomain.DomainName = "" oDomain.Status = -1 oDomain.DomainRedirectionHosts = "" oDomain.DomainRedirectionStatus = -1 If oDomain.FindFirstDomain = 1 And oDomain.DomainRedirectionStatus <> 1 Then SampleDomainName = oDomain.DomainName Response.Write "<SELECT NAME=""DomainName"">" do Response.Write "<OPTION VALUE=""" & oDomain.DomainName & """>" & oDomain.DomainName & "</OPTION>" oDomain.AccountName = Session("AUTH_ACCOUNT") oDomain.DomainName = "" oDomain.Status = -1 oDomain.DomainRedirectionHosts = "" oDomain.DomainRedirectionStatus = -1 Loop while (oDomain.FindNextDomain = 1) Response.Write "</SELECT>" Else Response.Write "Error: There are no domains defined for this account." End If Set oDomain = Nothing %> </TD> </TR> <TR class=ME_List1> <TD WIDTH=150>Mailbox:</TD> <TD> <INPUT ID=LoginID name=LoginID class=ME_Input style="WIDTH: 160px" onchange='ValidateMailboxName()' VALUE="<%=FrmLoginID%>"> @<%=Session("Signup_Postoffice")%> </TD> </TR> <TR class=ME_List0> <TD WIDTH=150>Password:</TD> <TD> <input style="width:160px" type=password class=ME_Input name=Password VALUE="<%=FrmPassword%>"> </TD> </TR> <TR class=ME_List0> <TD WIDTH=150>Confirm Password:</TD> <TD> <input style="width:160px" type=password class=ME_Input name=ConfirmPassword VALUE="<%=FrmConfirmPassword%>"> </TD> </TR> </TABLE> </CENTER> <BR> <CENTER> <TABLE WIDTH="90%" BGCOLOR="#f9fadd" BORDER=1 CELLPADDING=2 CELLSPACING=0> <TR> <TD class="ME_StandardText"> <B>Note:</B> When you sign in to MailEnable, you must append <%Session("Signup_Postoffice")%> to your mailbox name. eg: You would log in to webmail as Mailbox@Postoffice. Your e-mail address will be your mailbox name followed by the domain name you have chosen above eg: Mailbox@<%=SampleDomainName%>.<BR> </TD> </TR> </TABLE> <HR> <TABLE WIDTH=90%> <TR><TD align=right><input NAME="FormAction" type=submit class=ME_Button value="Create Account"></TD></TR> </TABLE> </CENTER> </FORM> <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- function ValidateForm() { if (window.document.all("LoginID").value.length <= 0) { alert("Please specify a mailbox name for your account."); return false; } if (window.document.all("Password").value.length < 6) { alert("Please specify a valid password. Passwords cannot be blank and must contain at least 6 characters."); return false; } if (window.document.all("Password").value != window.document.all("ConfirmPassword").value) { alert("Your password and confirmed password do not match. Please re-enter."); return false; } return true; } function ValidateMailboxName() { //if (window.document.all("LoginID").value.length <= 0) //{ // alert("The Mailbox name can not be blank."); // return false; //} return false; }
Scriptet bruger en fil i systemet til at snakke med min mailserver..
Lukker spørgsmålet da jeg har fået det til at virke med COM() funktionen.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.