First, I want to thank whoever takes this on ahead of time.

I'm just starting to learn php and have set up some sites using Geeklog. But
I need to automate email subscriptions.

I need to connect to a mail server using mail.myserver.com then take
variables from my input form that will create a mailbox and password. The
company that wrote the mail server software has an ASP script that does
this. However my server doesn't do asp and I'm not even sure that the script
they gave me even works.

Basically there are 2 files. I called them signup.htm and signup.php
(originally signup.asp) here are the files.

First the user will see an html file or we could change this to a php file I
guess.
----------------------------------------------------------------------------
--
<HTML>
<HEAD>
    <TITLE>Sign up</TITLE>

    <SCRIPT LANGAUGE="Javascript">

        function OnSubmit()
        {
            var pForm = document.forms["frm"];

            if ("" == pForm["Mailbox"].value)
                alert("Please enter your email name.");
            else if (pForm["Password1"].value !=
                    pForm["Password2"].value)
            {
                alert("Passwords do not match!  Please retype them.");
            } else if ("" == pForm["Password1"].value)
                alert("Please enter a password.")
            else
                pForm.submit();
        }

    </SCRIPT>
</HEAD>

<BODY>
    <FORM ID=frm METHOD=POST ACTION="signup.php">
        <TABLE>
            <TR>
                <TD>Email Name:</TD>
                <TD><INPUT TYPE=TEXT ID=Mailbox NAME=Mailbox></TD>
            </TR>
            <TR>
                <TD>New Password:</TD>
                <TD><INPUT TYPE=PASSWORD ID=Password1 NAME=Password1></TD>
            </TR>
            <TR>
                <TD>Retype New Password:</TD>
                <TD><INPUT TYPE=PASSWORD ID=Password2 NAME=Password2></TD>
            </TR>
        </TABLE>

        <HR>
        <INPUT TYPE=BUTTON VALUE=Submit onClick=OnSubmit();>
    </FORM>
</BODY>
</HTML>
-------------------------------------------------------------------------
Then we post to "signup.php" but originally it was "signup.asp" here is the
asp script and the what I've got started with the php script.
-------------------------------------------------------------------------
<%
    '
    ' Connect to the mail server.
    '
    Set MailAdmin = CreateObject("1CIS.MailAdmin")
    MailAdmin.Server = "mail.myserver.com"
    MailAdmin.Domain = "mydomain.com"
    MailAdmin.Password = "mypassword"
    MailAdmin.Connect

    '
    ' Create a new mailbox.
    '
    Set Mailbox = CreateObject("1CIS.Mailbox")
    Mailbox.Email = Request.Form("Mailbox")
    Mailbox.Password = Request.Form("Password1")

    '
    ' Save the mailbox.
    '
    MailAdmin.Update(Mailbox)

    '
    ' Disconnect from the mail server.
    '
    Set Mailbox = nothing
    MailAdmin.Disconnect
    Set MailAdmin = nothing
%>

<HTML>
<HEAD>
    <TITLE>Sign up</TITLE>
</HEAD>

<BODY>
    Your mailbox was created successfully.
</BODY>
</HTML>
--------------------------------------------------------
Now here is the "signup.php" that I've got started and I think you can see
that I'm am not a php programmer yet. You'll see I've commented out some
things trying to get this to work.
--------------------------------------------------------
<?php
//
// Connect to the mail server.
//

$MailAdmin = New COM("1CIS.MailAdmin");

$MailAdmin->Server="mail.myserve.com";
$MailAdmin->Domain="mydomain.com";
$MailAdmin->Password="mypassword";
$MailAdmin->Connect;

//
// Create a new mailbox.
//

$MailBox = New Com("1CIS.MailBox");
$MailBox->Email=$_POST["Mailbox"];
$MailBox->Password=$_POST["Password1"];

//
// Save the mailbox.
//
$MailAdmin->Update($Mailbox);

//
// Disconnect from the mail server.
//
// $Mailbox=null;

// $MailAdmin->Disconnect;
// $MailAdmin=null;

?>

<HTML>
<HEAD>
    <TITLE>Sign up</TITLE>
</HEAD>

<BODY>
    Your mailbox was created successfully.
</BODY>
</HTML>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to