smtp2gs [-h] [-m <MAXSIZE>] [-l <LISTID>] [-f <FILE>] [-t {server,message}] [-c <CONFIG>] [-i <INSTANCE>] url


smtp2gs to adds an email message to a GroupServer group. It is usually called by an SMTP server (such as postfix).

Positional Arguments


The URL for the GroupServer site.

Optional Arguments

-h, --help

Show a help message and exit

-m <MAXSIZE>, --max-size <MAXSIZE>

The maximum size of the post that will be accepted, in mebibytes (default 200MiB).

-l <LISTID>, --list <LISTID>

The list to send the message to. By default it is extracted from the x-original-to header.

-f <FILE>, --file <FILE>

The name of the file that contains the message. If omitted (or -) standard-input will be read.

-t {server,message}, --time-source {server,message}

Where to get the time that the message was written. Using server (the default) avoids issues caused by the clocks of the group members being incorrect. Using message will extract the post-time from the Date header.

-c <CONFIG>, --config <CONFIG>

The name of the GroupServer Configuration file (default INSTANCE_HOME/etc/gsconfig.ini) that contains the token that will be used to authenticate the script when it tries to add the email to the site.

-i <INSTANCE>, --instance <INSTANCE>

The identifier of the GroupServer instance configuration to use (default default).


smtp2gs returns 0 on success, or a non-zero value on an error (following the convention specified in /usr/include/sysexits.h). In addition the error message that is written to stderr starts with the enhanced mail system status code RFC 3463. These include transient errors and permanent errors.

Transient Errors

Any errors that can be solved by changing the configuration (either of postfix or the Configuration file) are marked as transient (with a 4.x.x status code).

Code Note Fix
4.3.5 Error with the configuration file. Correct the Configuration file.
4.4.4 Error connecting to URL. Check that the server is running, or alter the URL that is used to call smtp2gs.
4.4.5 The system is too busy. Wait.
4.5.0 Could not decode the data returned by the server. Usually this is caused by an invalid token in the Configuration file. Fix the token in the file.
4.5.2 No host in the URL. Alter the URL that is used in the call to smtp2gs so it has a host-name.

Permanent Errors

The five permanent errors are listed below.

Code Note
5.1.1 There is no such group to send the message to.
5.1.3 No x-original-to header in the email message.
5.3.0 The file containing the email was empty.
5.3.4 Email message too large.
5.5.0 Error communicating with the server (either while looking up the group information or adding the message).


Adding a post to a group in the general case, where the email is read of standard input:

$ smtp2gs

Over-riding the x-original-to header. This allows posts to an old email address to be sent to a new group.

$ smtp2gs --list newGroupId

Testing, by reading a file from /tmp

$ smtp2gs --file /tmp/test.mbox

Setting the maximum size of messages posted to a group to 1MiB

$ smtp2gs --max-size 1

Using the time-stamp in the message, rather than the current time on the server.

$ smtp2gs --time-source message

Using the token for a specific GroupServer instance called production

$ smtp2gs --instance production