• Delicious
  • Sales: 0800 634 6513
    General: 0845 053 0371

news and info

Command line access to VPOP3 settings

In VPOP3 v5 and later, all the settings are stored in the main database. While this makes it easier to backup, migrate and use database replication, it does make it a bit harder to access settings from outside of VPOP3.

You can use the ‘psql‘ command-line program, or a graphical tool like pgAdmin to access the settings.settings table to update the settings, but for many people this is inconvenient, and possibly a bit daunting.

So, we have made a little command-line utility called ‘vpop3settings’ which you can use to read/change settings from outside VPOP3. This can be used in an emergency, or possibly from a batch file or other scripting language, or whenever.

Using VPOP3Settings

To use this, download the vpop3settings program and extract the ZIP file to the desired location. It does not have to be in the main VPOP3 directory, but that can be a convenient location. You could even use it on a different computer, but this would need some settings changes to PostgreSQL on the VPOP3 PC. Note that you will also need the .NET runtime on the computer.

Then, you can run the program from a command prompt.

Running it as vpop3settings -? will give you a usage summary

USE: vpop3settings [options] <COMMAND> <PARAMETERS>
Options are:
 -h <VPOP3 PostgreSQL server address> (default 127.0.0.1)
 -p <VPOP3 PostgreSQL server port> (default 5433)
 -u <VPOP3 PostgreSQL username> (default vpop3)
 -w <VPOP3 PostgreSQL password> (default vpop3pass
 -d <VPOP3 PostgreSQL database> (default vpop3)
 -q ( don't display header )
Commands are:
 GET <setting name>
 GETDATA <setting name> ( get data only )
 SET <setting name> <setting data>
 SEARCH <data substring>
 REPLACEPATHS <old path> <new path>
 LIST

If you are using the command on a standard installation, on the VPOP3 computer itself, you will not usually need any of the first set of options, but if you are accessing the VPOP3 computer over a network, or have a non-standard installation, you can use the first few options to tell vpop3settings how to access the database

Then, the various commands are

GET

The GET command will retrieve one or more settings. You can use * and ? wildcards in the parameter. Note that the setting name parameter is backslash quoted. So, for instance, if you want to use \ you need to double it to \\.

eg

vpop3settings.exe GET \\Service-9\\*
Settings command line tool for VPOP3 v1.0- (c) 2013 Paul Smith Computer Services
\Service-9\~Bindings:0.0.0.0|143
\Service-9\~BindTo:0
\Service-9\~Enabled:1
\Service-9\~Encryption:0
\Service-9\~ID:9
\Service-9\~MaxIDLETime:30
\Service-9\~Name:IMAP4 Server
\Service-9\~Port:143
\Service-9\~Type:9

The response contains each matching setting on a line, with the name, followed by a colon, followed by the data. The data is backslash quoted as well – so a line break will be returned as ‘\n’, etc

GETDATA

This command is the same as GET, but the response only contains the data, not the setting name. This is not very useful if used with wildcards, but can be useful if you want a script or something to read a setting.

SET

This command lets you set a setting. The setting name parameter does not support wildcards, and is not backslash quoted, but the setting value parameter IS backslash quoted, to allow you to set line breaks etc in the data. For instance:

vpop3settings.exe set \~standardsig "\n\nThis was me"

SEARCH

This command lets you search the setting values for a certain value. Wildcards are allowed, and backslash quoting is used. For instance:

vpop3settings.exe search ?:\\*

will search for settings which contain likely file paths

REPLACEPATHS

This is a useful command when moving VPOP3. It will search the settings for values starting with the ‘oldpath’ setting, and offer to change them to begin with the ‘newpath’ value. Don’t use wildcards or backslash quoting in the parameters here. For instance:

vpop3settings.exe replacepaths c:\vpop3 d:\vpop3

LIST

This is exactly equivalent to GET *

 

After making changes

Note that VPOP3 monitors for changes in the settings tables, so in most cases, if you change a setting in the settings.settings table, it will take effect immediately, without needing a restart of VPOP3. In a few cases (e.g. when adding a new setting, rather than updating a setting) you may need to restart VPOP3.

Post a Comment