rabbitmq-smtp
has not seen updates in more than 3 years and will not work with recent versions of RabbitMQ.
It has since been superseded by rabbitmq-email. Please consider using that project first.
The RabbitMQ-SMTP plugin listens on a configurable TCP port for incoming email message traffic, and routes the traffic on via RabbitMQ's exchanges.
There is no support at this time for sending outgoing email from RabbitMQ.
You will need:
Once you are able to build the server and its plugins, you can build
the SMTP plugin. Within the rabbitmq-public-umbrella
directory,
hg clone http://hg.rabbitmq.com/rabbitmq-smtp
cd rabbitmq-smtp
make
At this point, the Makefile
will retrieve a copy of
erlang-smtp if it
hasn't done so already. It will then compile everything, resulting (if
all goes well) in the presence of
rabbitmq-smtp/dist/rabbitmq-smtp.ez
and
rabbitmq-smtp/dist/erlang-smtp.ez
. The plugins can then be activated
as per the instructions.
When an email arrives at the adapter, its SMTP "To" address is examined to determine how it should be routed through the system. First, the address is split into a mailbox name and a domain part. The mailbox name is then split at the first hyphen into two pieces.
@rabbitmq.com
") is used to map to an AMQP virtual-hostFor example, tonyg@rabbitmq.com
is mapped to
vhost_map
(see below on configuration) for rabbitmq.com
tonyg
"and tonyg-foo@rabbitmq.com
is mapped to
vhost_map
for rabbitmq.com
tonyg
"foo
"The plugin is configured using the normal Erlang application
configuration mechanism. RabbitMQ has a standard configuration
file that can be
used to configure the plugin. The application name is
rabbitmq_smtp_server
, and the individual keys are described below.
Here is an example snippet of a RabbitMQ configuration file containing
rabbitmq_smtp_server
settings:
...
{rabbitmq_smtp_server, vhost_map, [{"localhost", <<"/">>}]},
{rabbitmq_smtp_server, default_vhosts, true},
{rabbitmq_smtp_server, listen_port, 8025},
...
Two configuration variables control this process. The first,
vhost_map
, should be set to a list of tuples with the first element
set to a string for the domain to map from, and the second element set
to a binary for the virtual-host to map to. For example, the default
value for vhost_map
is
[{"localhost", <<"/">>}]
which maps the SMTP "@localhost
" domain onto the usual preconfigured
virtual-host "/
".
In cases where the plugin searches for a domain in the vhost_map
but
cannot find one, the second configuration variable, default_vhosts
is consulted. If it is set to the atom true
, then the SMTP domain is
used directly as the name of the AMQP virtual-host. If it is set to
the atom false
, then the plugin will instead return an error for
uses of the missing domain.
Two configuration variables are used here:
listen_host
, which should be set to a string containing an IP
address. The default setting is "0.0.0.0"
.
listen_port
, which should be set to an integer containing a TCP
port number. The default setting is 8025
.
(tbd)
Copyright (c) 2007--2010 Tony Garnock-Jones tonyg@kcbbs.gen.nz Copyright (c) 2007--2010 LShift Ltd. query@lshift.net
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.