Pegasus Mail & Mercury

Welcome to the Community for Pegasus Mail and
The Mercury Mail Transport System, the Internet's longest-serving PC e-mail system!
Welcome to Pegasus Mail & Mercury Sign in | Join | Help
in
Home Blogs Forums Downloads Pegasus Mail Overview Mercury Overview Wiki

Programmatic creation of local user account

Last post 08-16-2011, 16:00 by Gustav. 13 replies.
Sort Posts: Previous Next
  •  06-16-2011, 19:46

    • ian22 is not online. Last active: 06-17-2011, 6:06 ian22
    • Not Ranked
    • Joined on 06-16-2011
    • Member
    • Points 75

    Programmatic creation of local user account

    Hi everyone, I just recently setup for the first time setup Mercury 32's IMAP server. So far so good as I have "some" experience with mail servers and it seems to be working fine. I do a lot of software development and after googling for a couple hours could find no insight as to how one would go about pro-grammatically creating user accounts in Mercury 32. I haven't the slightest idea of how Mercury stores user account information on the back-end so I have come here to the official Mercury forum to find out if anyone has any ideas on how I could go about doing this. Thanks in advance for any responses!
  •  06-16-2011, 20:20

    • Rolf Lindby is not online. Last active: 2012-05-18, 23:27 Rolf Lindby
    • Top 10 Contributor
    • Joined on 05-08-2007
    • Stockholm, Sweden
    • SuperStar
    • Points 17,215
    • BetaTeam Moderator SystemAdministrator

    Re: Programmatic creation of local user account

    Peter has shared some code for how to interact programmatically with Mercury user accounts here:

    http://community.pmail.com/files/folders/codesnippets/entry167.aspx

    /Rolf

  •  06-16-2011, 21:54

    • ian22 is not online. Last active: 06-17-2011, 6:06 ian22
    • Not Ranked
    • Joined on 06-16-2011
    • Member
    • Points 75

    Re: Programmatic creation of local user account

    Thanks Peter, I'm not familiar with Delphi Pascal but can understand bits and pieces of the code. I'll take a closer look and let you know if I get stuck on something.

    EDIT: I can see the code creates accounts but was wondering if a restart of Mercury was necessary for the new users to be added after the script completes.

  •  06-16-2011, 23:51

    • Rolf Lindby is not online. Last active: 2012-05-18, 23:27 Rolf Lindby
    • Top 10 Contributor
    • Joined on 05-08-2007
    • Stockholm, Sweden
    • SuperStar
    • Points 17,215
    • BetaTeam Moderator SystemAdministrator

    Re: Programmatic creation of local user account

    Mercury will need re-read the user list. You can do this by writing a message file in the queue directory with a command to maiser (the built-in mail server account).

    The file should have the filename extention .101 and start with:

    $$ admin@domain.com
    maiser@domain.com

    and a blank line.

    The message should be:

    PASSWORD mypassword
    RELOAD USERS
    EXIT

    /Rolf 


  •  06-17-2011, 0:59

    • ian22 is not online. Last active: 06-17-2011, 6:06 ian22
    • Not Ranked
    • Joined on 06-16-2011
    • Member
    • Points 75

    Re: Programmatic creation of local user account

    Perfect, that makes since. I was able to create that file and add to the queue directory but when it is picked up it doesn't process the command. I am not sure if it is because I didn't set the mail server password correctly (in Mercury I clicked on "Configuration > Mail server > General" and type in "AdminPasswords" then clicked edit and added the password "test123" to the first line for testing purposes and hit "Save") or because of some other issue.

    My .101 file contains the following:

    $$ admin@192.168.0.57
    maiser@192.168.0.57

    PASSWORD test123
    RELOAD USERS
    EXIT

    I am using my local ip temporarily and set it in the Mercury core module "General" tab and added it to the list of local domains. Is there a log I should look at somewhere to see why the command wasn't processed?

    Thanks for your continued help!

  •  06-17-2011, 1:27

    Re: Programmatic creation of local user account

    > Perfect, that makes since. I was able to create that file and add to the queue directory but when it is picked up it doesn't process the
    > command. I am not sure if it is because I didn't set the mail server password correctly (in Mercury I clicked on "Configuration > Mail
    > server > General" and type in "AdminPasswords" then clicked edit and added the password "test123" to the first line for testing purposes
    > and hit "Save") or because of some other issue.
    >
    > My .101 file contains the following:
    >
    > $ admin@192.168.0.57
    > maiser@192.168.0.57

    The domain of maiser is the entry in Configuration | Mercury core | Internet name for this system.  If this does not match then this will be ignored.

    When using literal addresses you need to enclose them in brackets in both the e-mail address and other entries in Mercury as well.

    >
    > PASSWORD test123
    > RELOAD USERS
    > EXIT
    >
    > I am using my local ip temporarily and set it in the Mercury core module "General" tab and added it to the list of local domains. Is
    > there a log I should look at somewhere to see why the command wasn't processed?

     


    Thomas R. Stephenson
    San Jose, California
    Member of Pegasus Mail Support Team

    I do not answer private messages from the forum. If you want to contact me use email to techsupp@tstephenson.com.
  •  06-17-2011, 13:00

    • Gustav is not online. Last active: 2011/08/16, 16:03 Gustav
    • Not Ranked
    • Joined on 02-10-2009
    • Member
    • Points 80

    Re: Programmatic creation of local user account

    I have a comprehensive VBA code module for user maintenance and message creating like:

    Public Function Mercury32User_Create( _
      ByVal strUsername As String, _
      ByVal strUserPassword As String, _
      ByVal booAdminRights As Boolean, _
      Optional ByVal strUserFullName As String) As Variant

    If someone could tell me, please, how to upload it to, say, the code snippets?

     

  •  06-17-2011, 19:09

    • Rolf Lindby is not online. Last active: 2012-05-18, 23:27 Rolf Lindby
    • Top 10 Contributor
    • Joined on 05-08-2007
    • Stockholm, Sweden
    • SuperStar
    • Points 17,215
    • BetaTeam Moderator SystemAdministrator

    Re: Programmatic creation of local user account

    Click Downloads from the top menu and select Community downloads / Add-ons for Mercury. Then click Upload and fill in the form.

    /Rolf

  •  06-18-2011, 16:32

    • Gustav is not online. Last active: 2011/08/16, 16:03 Gustav
    • Not Ranked
    • Joined on 02-10-2009
    • Member
    • Points 80

    Re: Programmatic creation of local user account

    Sorry, that's what I thought and have looked for, but nowhere I see an Upload button, link, or the like.

    Could you be more specific please?

     /gustav

  •  06-18-2011, 19:58

    • Rolf Lindby is not online. Last active: 2012-05-18, 23:27 Rolf Lindby
    • Top 10 Contributor
    • Joined on 05-08-2007
    • Stockholm, Sweden
    • SuperStar
    • Points 17,215
    • BetaTeam Moderator SystemAdministrator

    Re: Programmatic creation of local user account

    1. Be sure that you are signed in to the site.

    2. Go to Community Downloads / Add-Ons for Mercury as previously described.

    3. Look for the Upload button just above the table named "Files in this Folder".

    /Rolf 

  •  06-19-2011, 0:28

    • Gustav is not online. Last active: 2011/08/16, 16:03 Gustav
    • Not Ranked
    • Joined on 02-10-2009
    • Member
    • Points 80

    Re: Programmatic creation of local user account

    Ah, sorry, was messing around in the Code Snippets area.

    Thanks!

    /gustav

  •  07-26-2011, 12:48

    • Gustav is not online. Last active: 2011/08/16, 16:03 Gustav
    • Not Ranked
    • Joined on 02-10-2009
    • Member
    • Points 80

    Re: Programmatic creation of local user account

    OK, so I did - or at least I think so. There was a message about approval before it would be made visible but that's now a couple of days ago?

    /gustav 

  •  07-28-2011, 0:01

    Re: Programmatic creation of local user account

    I'm ba'ack - approved the file.

    Edit: Didn't verify if the file works as intended, but it looks ok. Pls note that if you fibble with the alias file, it has to be sorted (ascending order) 


    Kind regards / Peter
  •  08-16-2011, 16:00

    • Gustav is not online. Last active: 2011/08/16, 16:03 Gustav
    • Not Ranked
    • Joined on 02-10-2009
    • Member
    • Points 80

    Re: Programmatic creation of local user account

View as RSS news feed in XML

Contact | Advertise | Host provider: PraktIT | Terms of Use | Privacy Statement
Copyright © 2007-2011 David Harris / Peter Strömblad. | Pegasus Mail Home Page