Mireka can relay mails sent to one or more or even any addresses to another SMTP server.
When acting as a proxy, Mireka relays the SMTP statements received in a mail session to a backend server step-by-step in real-time. In this way both this server and the backend server is able to reject a mail within the SMTP session, before accepting the responsibility of delivering the mail. This fast-fail behaviour is useful in some situations.
First edit mireka.js
and configure the value of the backendServer
variable. For example if your backend server is backend.example.com
and
listens on port 2525, your configuration should look like this:
... backendServer = setup(BackendServer, { host: "backend.example.com", port: 2525, clientFactory: clientFactory }); ...
Note: you can freely specify another backend server for a different set of recipient addresses.
submission/submission.js
, and
TransmitterDestination
line
RelayDestinaton
line.
...
destination: setup(TransmitterDestination),
destination: setup(RelayDestination, {
backendServer: backendServer
})
...
Note: if you want to proxy each and every mail, then simply do not define any local recipients.
In order to proxy some or all local addresses, edit local-recipients.js
and insert the proxy mapping below the
comment ENTER YOUR RECIPIENT-DESTINATION MAPPINGS HERE.
For example if you want to relay every local address to the backend server,
then insert the following code:
... massProxy(backendServer, [ setup(AnyRecipient) ]), ...
Here is a complex example for selectively relaying specific addresses:
... massProxy(backendServer, [ // Fully specified recipients setup(InlineRecipientRegistry, { addresses: [ "john@example.com", "jack@example.com" ] }), // A wildcard recipient, only the local part is specified setup(CaseInsensitiveAnyDomainRecipient, { localPart: "anonymous" }), // Another wildcard recipient with regular expression setup(RegexAddressSpecification, { localPartRegex: ".*-bounces-.*", remotePart: "lists.example.com" }), // Any postmaster address setup(AnyPostmaster), // Addresses corresponding to local user accounts setup(GlobalUsersRecipientSpecification, { users: globalUsers }), ]), ...
Tip: Proxy mappings should be placed near the end of
local-recipients.js
, so locally handled addresses will not be shadowed
accidentally by proxied addresses specified using wildcards.