Email Server LANMailServer

IMAP, POP3, and SMTP for Local Networks with Autoresponder and Email Distribution Groups

 

Online help for LANMailServer

Email Server for Local Networks POP3 IMAP4 IMAP with Autoresponder, SMTP Relay Server, Email Distribution Groups, OAuth2 Support
 
 

 

General

Password to protect the LANMailServer ConsoleEnter a password; this must be entered each time the LANMailServer Console starts and when the settings are opened.

 

Folder for data storageThe folder is for viewing only; it cannot be changed.

LANMailServer needs to store files, such as emails sent to the LANMailServer SMTP server or all saved emails of configured users.

The System user and Administrators must have full access to the folder; users must be able to read/execute, write, modify, and view folder contents. Permissions for the user can be removed if you always run the LANMailServer Console as an administrator.

Changing the data folder (for experts only!)

The data folder should never be changed; if you do so, it is at your own risk!

NEVER place the data folder on a network drive, removable media, cloud drive, or NAS storage. This can lead to database corruption in the event of connection issues. The database CANNOT be repaired.

Create a new data folder on a local hard drive. The System user and Administrators must have full access to the folder; users must be able to read/execute, write, modify, and view folder contents. Permissions for the user can be removed if you always run the LANMailServer Console as an administrator.

Stop the LANMailServer service through Control Panel - Administration - Services.

Copy all files from the current data folder, typically C:\ProgramData\LANMailServer, to the new data folder.

 

Start regedit, navigate to

Computer\HKEY_LOCAL_MACHINE\ SOFTWARE\LANMailServer

Change the string DataPath to the name of the new folder.

For 64-bit systems, navigate to

Computer\HKEY_LOCAL_MACHINE\ SOFTWARE\WOW6432Node\LANMailServer

Also change the string DataPath to the name of the new folder here.

 

Restart the service.

 

Errors can be found in the Windows Event Log or in the file LMLog.txt in the new data folder.

 

 

Storing email data Locally in the data folder, using an SQLite database

Stores the SQLite database with email data in the data folder; this is the default setting.
The SQLite database stores the essential data of an email and emails up to 100KB. Larger emails are compressed in the data folder.

For many local email accounts and/or a high volume of email access and email sending, using MySQL is recommended, as SQLite usage can lead to significant delays or error messages.

Using a MySQL database

Stores data in a MySQL database; MySQL 8.0 or MariaDB 10.2 or later with utf8mb4_general_ci encoding is required. Older MySQL/MariaDB versions are not supported as SQL Window functions are used by LANMailServer.
The MySQL database should be installed on the same computer as LANMailServer to avoid delays (network latency). Only the essential data of an email is stored in the MySQL database; the email itself is compressed in the data folder.

 

Note:
The data in the SQLite and MySQL databases is not retained when switching storage methods. These cannot be exported or imported either, as the table structure and stored data differ.

Install MySQL server yourself

 

Maximum size of the log fileSpecify the maximum size of the log file before LANMailServer deletes old entries. The default size is 1 MB.

 


Local Email Accounts

Local domain name, which should also be a valid internet domainEnter the domain name to be used for incoming and outgoing emails. The domain name should be a valid internet domain so that emails sent to the internet are valid.

e.g., mydomain.de

LANMailServer checks all emails sent via LANMailServer SMTP against this domain name. If a local email account exists for this domain name and the local part of the email address (before the @), the email will not be sent to the internet but directly imported into the local email account.

 

 

Optionally, other local domain namesAdditional domain names can be specified, which may be useful if multiple email addresses with different domains are used.

e.g.,
mydomain.com
mydomain.eu
mydomain.co.uk

 

LANMailServer checks all emails sent via LANMailServer SMTP against these domain names. If a local email account exists for one of the domain names and the local part of the email address (before the @), the email will not be sent to the internet but directly imported into the local email account.

 

Checking external email accountsSet how often and optionally during which period external email accounts should be checked for new emails. External email accounts can be defined for each local email account. LANMailServer checks the external email accounts at the specified interval and imports the emails into the local email account.

Checking external email accounts is only performed if LANMailServer has detected an internet connection. The internet connection type must be set to "Connection via LAN/permanent line/DSL via router."

See also

Configure local email accounts

 

Delete copies of emails kept in external mailboxes afterEnable this setting and specify the number of days after which emails in external mailboxes are automatically deleted.

Note: Emails in external mailboxes are only deleted if this email account is regularly accessed.

 


Internet Connection

Type of Internet ConnectionConnection via LAN/leased line/DSL through a router

Use this setting if you have a permanent internet connection.

Offline mode, do not establish an internet connection

Never establishes an internet connection. All emails in the outgoing queue will never be sent.

 

Important Note

The type of internet connection affects the LANMailServer SMTP server. The SMTP server only attempts to send emails when you are online. If there is no connection, the SMTP server writes the data to a file (queue) on your hard drive and sends it once you are online.

 

 

POP3 Server

TimeoutSet the time how long LANMailServer should wait for a response from the email program.

 

Port (Default 110)The port setting should only be changed if you are running another POP3 server on your PC. When changing the port, you must also update the port specification in your email program.

 

SSL Port (Default 995)The port setting should only be changed if you are running another POP3 server on your PC. When changing the port, you must also update the port specification in your email program.

Specify port -1 to not run a POP3 server secured via SSL.

See also: Notes on SSL access

 

Access RestrictionThis setting is important to protect the LANMailServer POP3 server from unauthorized access.

Possible settings:

Anyone can receive emailsThis setting allows any user within the local network or from the internet to use the LANMailServer POP3 server.

This setting is not recommended!

 

Emails can only be received on this PCThis is the default setting. Emails can only be received on the local PC.

 

Anyone can receive emails if the IP addresses match this patternSpecify one or more IP addresses (IPv4 and IPv6) separated by semicolons that can retrieve emails via the POP3 server. Wildcard characters * or ? can be used, e.g., 192.168.* allows any user to receive emails if the user's IP address starts with 192.168.

 

 

 

IMAP4 Server

TimeoutSet the time how long LANMailServer should wait for a response from the email program.

 

Port (Default 143)The port setting should only be changed if you are running another IMAP4 server on your PC. When changing the port, you must also update the port specification in your email program.

 

SSL Port (Default 993)The port setting should only be changed if you are running another IMAP4 server on your PC. When changing the port, you must also update the port specification in your email program.

Specify port -1 to not run an IMAP4 server secured via SSL.

See also: Notes on SSL access

 

IMAP APPEND for all mailboxesDefault: 100 MB

This value indicates the maximum size of an email that can be added to a folder (mailbox) via an IMAP APPEND command from a client program. Enter a value of 0 to prohibit adding emails.

When emails are sent via SMTP, the email program uses the IMAP APPEND command to store the sent email in the "Sent Items" folder. If the email exceeds the size limit, the email program may completely refuse to send the email.

 

Access RestrictionThis setting is important to protect the LANMailServer IMAP4 server from unauthorized access.

Possible settings:

Anyone can receive emailsThis setting allows any user within the local network or from the internet to use the LANMailServer IMAP4 server.

This setting is not recommended!

 

Emails can only be received on this PCThis is the default setting. Emails can only be received on the local PC.

 

Anyone can receive emails if the IP addresses match this patternSpecify one or more IP addresses (IPv4 and IPv6) separated by semicolons that can retrieve emails via the IMAP4 server. Wildcard characters * or ? can be used, e.g., 192.168.* allows any user to receive emails if the user's IP address starts with 192.168.

 

 

 

SMTP Server

TimeoutSet the time LANMailServer should wait for a response from the email program when sending emails. This setting also affects the wait time between the provider's SMTP server or, when using the LANMailServer server, the wait time when connecting to the email server of the email recipient.
Increase the time if there are issues with email sending.

 

Port (Default 25)The port setting should only be changed if you are running another SMTP server on your PC. When changing the port, you must also update the port specification in your email program.

 

SMTP Authentication Always Required

 

If this setting is enabled, every email program must authenticate with the username/password of a local email account. Without authentication, email sending to internal and external email accounts will always be denied.

If authentication is not required (i.e., anyone can send emails), deactivate this option and choose the not-recommended option "Open Relay."

Important

  • Email sending without authentication poses a security risk, as any program, including viruses and worms, could send emails.
  • Email archiving is not performed when emails are sent without authentication, as the local email account is unknown in such cases.

Choose the variant "SMTP Auth. Always Necessary for Internet Sending, Not Necessary Locally" to allow emails to be sent to local email accounts without authentication. Emails sent to the internet (non-local email addresses) can only be sent with authentication. This option must be used if LANMailServer is to accept emails directly from the internet via SMTP (Port 25).

 

Allow Encrypted Connections via StartTLS

 

Enable this setting to allow an email program to establish an encrypted connection to the server via StartTLS.

See also: Notes on SSL Access

 

Sender Email Address Must Be a Local Email AccountEnable this option to ensure the SMTP server only accepts emails from senders for whom a local email account is configured.

 

Always Send Emails for Existing Local Email Accounts to the InternetDefault: Disabled.

If this function is disabled, emails sent through the LANMailServer SMTP server will be sorted into the respective local account if the email recipient is a local email account.

Enable this function to send the email to the internet even if the recipient has a local email account. The email will also be saved in the local email account; LANMailServer will not retrieve the email again from the external mailbox. To access the external account, IMAP4 should be used, so LANMailServer can more easily filter emails that are already stored in the local email account. When accessing via POP3, the entire email is retrieved from the external mailbox and discarded after verification.

 

Access RestrictionThis setting is important to protect the LANMailServer SMTP server from unauthorized access.

Possible settings:

Anyone can send emailsThis setting allows any user within the local network or from the internet to use the LANMailServer SMTP server.

This setting is not recommended as LANMailServer could be misused for sending spam emails!

 

Emails can only be sent from this PCThis is the default setting. Emails can only be sent from the local PC.

 

Anyone can send emails if the IP address(es) match this patternSpecify one or more IP addresses (IPv4 and IPv6) separated by semicolons that can send emails via the SMTP server. Wildcard characters * or ? can be used, e.g., 192.168.* allows any user to send emails if the user's IP address starts with 192.168.

 

 

   
Email Sending 
The email sending settings are used for sending emails to the internet for all local email accounts. For each local email account, a different SMTP server or other SMTP authentication data can also be specified separately.

 

Direct Sending: LANMailServer Assumes the Functions of an SMTP ServerUse this setting to allow LANMailServer itself to assume the functions of an SMTP server.

Using the LANMailServer SMTP server is only possible for security reasons if the username and password of the local email account are specified in the email program under the option "Server Requires Authentication."

This setting is only recommended if you have a permanent internet connection. If using a dial-up connection, there may be issues with email sending as some servers prohibit receiving emails with an IP address from a dial-up connection or immediately mark them as spam or delete them.

 

Use This SMTP ServerEnter the SMTP server of an email provider. Also required are the username and password for email sending (SMTP authentication) of the email provider.

Use "Modern Authentication" OAuth2 instead of BASIC/Standard Authentication for mailbox access or email sending


LANMailServeronly supports email providers with SMTP authentication or OAuth2 for security reasons.

Optional Specification: "Optional, Always Overwrite Sender Email Address with This Email Address"

Enter a valid email address to use only this email address as the sender email address for every email sent to the internet. This makes it possible to use a different domain locally than the internet domain.

Placeholder %localpart%: Use the placeholder %localpart% to overwrite the local username of the LANMailServer user for the local part of the email address (before the @), e.g., max@mustermann.de as the sender email address should be overwritten with %localhost%@musterfrau.de, so the sender email address of the outgoing email will be max@musterfrau.de.

Note: If a separate SMTP server is defined in the user's local email account, this SMTP server will always be used for sending emails to the internet.

 

Failed DeliveriesSpecify after how many days LANMailServer should stop attempting to send an email to the internet. The email will be returned to the sender as "Undeliverable." If the sender no longer exists, the email will be forwarded to the Postmaster.

 

Maximum Number of Sending ThreadsSet the number of sending threads (simultaneous email sending) LANMailServer should use for sending emails to the internet. A typical value is 1 thread. If you have a high internet upload rate, you can increase this value to achieve faster email sending.

 

SMTP Helo NameAn optional valid domain can be entered here in case the external SMTP server refuses to accept emails due to an invalid Helo name.

 

Add a Digital Signature (S/MIME) to Emails
Enable this setting to add a digital signature to all outgoing emails. Click the "Digital Signature" link to change the S/MIME settings:
Send Signed Messages as Plaintext EmailsEnable this setting to send the emails as plaintext emails, allowing them to be displayed in all email programs even without S/MIME support.

 

Use Installed S/MIME Certificate from Windows Based on the Sender's Email AddressThis is the recommended setting.

In Windows, under Control Panel - Internet Options, the digital certificate for the respective sender email address should be imported. It will then be available system-wide for all applications in Windows.

Note: If no certificate exists for the sender's email address, the email will not be sent.

 

Use the Following CertificateAlternatively, specify the folder and filename of the PFX file and the private password to ensure LANMailServer always uses this certificate.

Note:
When using this option, it is not checked whether the certificate matches the sender's email address. If the certificate does not match the sender's email address, the email will be considered "forged" by the recipient email program.

 

 

Add a DomainKey Signature to Emails
This option allows adding a DomainKey signature to each email. Click "Add DomainKey Signature" to enter the DomainKey selector and private key. This information is provided by your administrator or server provider.

DomainKeys on Wikipedia

 

Limit Emails to Be Sent toEnable this option and specify the maximum email size in MB. If an email sent to LANMailServer exceeds this size, its acceptance will be denied.

 

Limit Recipients per Email toLimits the number of recipients per email in case the external SMTP server has a recipient limit. This results in a single email being split into multiple emails for sending.

e.g.,

If an email needs to be sent to 250 recipients as CCs and the external SMTP server has a limit of 2 recipients per email, LANMailServer will split the email into 125 individual emails, each with 2 recipients, and send them to the external SMTP server.

This setting can also be used to bypass the GoogleMail error "451-4.3.0 Multiple destination domains per transaction is unsupported." Specify a limit of 1 in such cases. Emails with recipients in different destination domains will be individually sent to the GoogleMail server.

 

Limit Sending from Outgoing Queue toIf a very large number of emails are intended for internet sending, the SMTP server used might reject the emails. After enabling this option, specify the maximum number of emails that should be sent to the external SMTP server before a pause is taken.

 

Email Pickup
 

Enable this setting to regularly check a folder for .eml files. The included .eml files will be loaded and either distributed locally or sent to the internet. Sending occurs without confirmation or prior warning.

Notes:

  • The LANMailServer service must have read and write permissions for this folder.
  • Only .eml files in this folder will be searched, loaded, sent, and deleted; all other files remain untouched.
  • The .eml files must be properly formatted and encoded, e.g., they can be created using Thunderbird.
  • For security reasons, access to this folder should be restricted to prevent malicious software from placing .eml files there.

 


Autoresponder

If the autoresponder has been enabled for local email accounts, the following options influence the autoresponder function.

Avoid Email LoopsEnable these settings to ensure emails from other autoresponders are not answered. Detection is based on the email header fields X-Loop, X-Auto-Response-Suppress, or Auto-Submitted. If none of these fields are present, the email is considered a non-autoresponder email.

 

Insert X-Loop Header Field into All Emails Sent by AutoresponderAdds the X-Loop header field to the automatic reply email, so other autoresponders do not automatically reply to the email if supported by their software.

 

Limit Number of Autoresponder Emails Sent to One Address Per DayIf the opposing autoresponder does not respect the X-Loop header field, an endless loop may occur when responding to emails. To prevent this, you can specify the maximum number of emails sent to a target email address per day. Once this limit is exceeded, no further emails will be automatically responded to or sent.

 

The email limit applies separately for each configured local user.

 

Autoresponder Template for Creating New Local Email AccountsA default text can be stored, which will automatically be used when creating new email accounts.

 

 

SMS Sending (only for Germany, Austria, and Switzerland)

To send SMS messages for incoming emails, you need to register with the SMS service SMSout.de. The SMS is sent using the HTTP protocol, and encrypted transmission (HTTPS) can also be used.
For each local email account, you can individually enable SMS sending and specify a mobile number.

SMSout.de UsernameEnter your SMSout.de username.

 

SMSout.de Password:Enter your SMSout.de password.

 

Use HTTPS Connection

 

Enable this setting to send SMS messages via an encrypted HTTP connection.

 

SMS Sending ModeChoose the "Without own sender" variant to send SMS messages with any phone number (the cheapest option). With the "With own sender" variant, your mobile number or the sender text stored in SMSout.de will be used.

 

Contents of the Email to be Sent as SMSEach SMS may contain a maximum of 160 characters; texts with more than 160 characters will be shortened to 160 characters.

Sender and Subject of the Email
LANMailServer composes a character string from the sender (name and email address) and the subject of the email and sends this via SMS.

Sender, Subject, and Start of the Email
LANMailServer composes a character string from the sender (name and email address), the subject of the email, and the text of the email and sends this via SMS.

 

 

Appearance

Define the style in which the LANMailServer Console program interface should be displayed. After changing the style, the LANMailServer Console should be closed and restarted.

 

Advanced

Internal Settings

Create Log File for Error DetectionWhen this setting is enabled, log files are created in the user's Temp directory containing communication between client and server, as well as communication between external email servers and LANMailServer.

Note: This setting should be disabled if not used, as the log files will eventually consume the entire hard drive storage space.

 

Log POP3/IMAP4 Commands Without Results for Error DetectionIf errors occur during POP3/IMAP4 access by an email program, this option can be enabled to facilitate error tracking. Unlike the "Create Log File for Error Detection" option, only commands are recorded in the log, without potentially large data results.

 

Log SQL Statements Without Results for Error DetectionRecords all SQL statements in the log, which can facilitate error tracking.
Automatic Server RestartThe server is automatically restarted once per day; you can specify the time for the restart here (default: 03:00 a.m.). This setting is only meaningful if LANMailServer runs 24 hours a day.

 

Permanently Delete Automatically Deleted Emails in MailboxesMany email programs only set the delete flag for emails when accessed via IMAP but never actually delete (EXPUNGE) them. LANMailServer can automatically delete emails at the specified interval, as they will no longer be displayed by the email program.

 

Maximum Supported TLS Version for Accessing External POP3, IMAP4, and SMTP ServersSelect the highest supported TLS version. If an antivirus program reports the error "Invalid Certificate" in connection with TLS v3, it means the antivirus program does not support the certificate. In this case, you can set the highest TLS version to 1.2.

 

SSL Certificate

Use Internal SSL Certificate for Server Name "localhost"This is the default setting; the internal self-signed LANMailServer certificate for the server name "localhost" will be used. If the server name differs, a custom certificate with the correct server name must be used; otherwise, the email program will repeatedly display the error "Target principal name is incorrect."

Notes on SSL Access

 

Use Custom SSL Certificate
Select this option to use a custom certificate. A custom certificate can be created as a self-signed certificate using OpenSSL software, or alternatively, a certificate from a trusted authority can be used. The certificate must contain the correct server name; otherwise, the email program will repeatedly display the error "Target principal name is incorrect."

Guide: Create Custom Self-Signed Certificate with OpenSSL

Notes on SSL Access

 

 

HTTP API/OAuth2 Server

The HTTP server is used to implement the JSON API for creating, deleting, and modifying users. Additionally, the HTTP server supports OAuth2 authentication if the email program allows configuration of custom apps.

Enable HTTP API/OAuth2 ServerActivates the HTTP server.

JSON API Notes:

  • Only HTTP POST calls with the header entry APIkey: <API Key> are accepted; all other calls are rejected with an error.
  • Calls must contain valid JSON code with UTF-8 encoding. Incorrectly encoded calls are rejected with a 406 error.
  • Examples can be found in the LANMailServer program folder: file api_sample.php as a PHP variant, APISample.dpr as a Delphi variant.

OAuth2 Notes:

  • All OAuth2 calls are interpreted based on the directory specification /oauth2/.
  • For each local user, you can create OAuth2 clients and access areas.
  • The email program must support OAuth2 authentication to be fully configurable.

 

HTTP PortEnter the HTTP server port; default is 6080.

 

HTTPS PortEnter the HTTPS server port; default is 60443.

Notes:

  • The email server's SSL certificate is used as the SSL certificate.
  • If the HTTP server should not support HTTPS, specify port -1.

 

API KeyDisplays the API key that must be transmitted in the header for each POST call: APIkey: <API Key>

You can generate a new API key. After saving, you must update the API key in all custom scripts and programs.

 

 

JSON API Commands

CommandNotes
get_versionReturns the LANMailServer version and API version.

 

get_usersReturns all created users without groups as an array. Optionally, you can pass "onlyActive" = true or false to retrieve only active users or also inactive ones.

 

get_userReturns the stored data of a user. You must also pass either id or username. id and username can be obtained via the get_users command.

 

update_userUsed to modify a user. You must also pass either id or username for the user to be updated. id and username can be obtained via the get_users command.

Use get_user to retrieve the stored data and field names. When updating the user, the field names must be used with the same spelling. The password cannot be changed via API.

All characters must be transmitted as UTF-8 encoded.

 

create_userCreates a new user. You must also pass username and password, optionally Active true or false. If successful, the id of the new user is returned.

 

remove_userDeletes a user and all stored emails of the user permanently. You must also pass either id or username. id and username can be obtained via the get_users command.

 

 

OAuth2 Endpoints and Parameters

 

ClamAV

ClamWin and clamd must be installed on your computer.

Using ClamAV/ClamWin/Clamd with LANMailServer

Server Name with clamd and PortEnter the server name and port; this is usually localhost and 3310.

 

Maximum Email SizeSpecify the maximum email size for scanning. The larger the email, the more time is needed for scanning.

Pay attention to the StreamMaxLength setting in the clamd.conf file; the size specified here must not exceed StreamMaxLength.

 

Scan All Incoming Emails from External Email AccountsScans all emails retrieved from external email mailboxes via LANMailServer. If a virus is found, the emails are deleted or marked with a tag in the subject.

 

Scan All Emails Sent via SMTPScans all emails sent via the LANMailServer SMTP server. If a virus is found, sending is denied.

 

Add Header Entry "X-Virus-Scanned: ClamWin"Adds an email header entry

X-Virus-Scanned: ClamWin

to each scanned email. In your email program, e.g., Thunderbird, you can view the email headers to determine if the email was scanned.

 

Create Log Entry When Scanning EmailsCreates a log entry during email scanning. If a virus is found, a log entry is always created.

 

Handle Infected Emails from External Email Accounts...Specify whether infected emails should be deleted or marked with a tag in the subject.

 

 

Language

Select the language of the program interface and messages displayed on screen and in the log file. After changing the language, you must restart the LANMailServer service to ensure the service outputs log messages in the selected language.

 

Notes on SSL Access

For SSL access, LANMailServer includes its own self-signed certificate for the server name "localhost." If the email program or antivirus software issues a warning during SSL-secured access, this certificate must be added to the Windows certificate store. To install the certificate, follow these steps:

  1. Press Windows key and R to display the Windows Run dialog.
  2. Enter certmgr.msc in the Run dialog and click OK.
  3. In the certificate manager, select Trusted Root Certification Authorities and then Certificates on the left.
  4. Under the Action menu - All Actions, select Import.
  5. Select the certificate lanmailserver.crt in the LANMailServer program folder and let it be imported.

 

 

 

 

Manual last updated: Fri, 4 Apr 2025 10:59:06 +0100

Manual as complete RSS feed: Manual as RSS feed

Manual localized with Microsoft Copilot

Erstellt mit RSSWriter https://www.rsswriter.de