gotthardp/rabbitmq-email

Crashes on receiving message

Miljar opened this issue · 4 comments

I want to use this plugin to process incoming mails for an application which already uses RabbitMQ. The alternative was using a cron script and read data from the SMTP server immediately, but this fits more nicely in our setup.

I have installed & configured Postfix as per the instructions in the readme. I have compiled & installed the plugin as per the instructions in #9.

When I use a (PHP) test script to send a mail, I can see that the RabbitMQ server instance receives a TCP connection from the Postfix server, but then nothing happens anymore.

In the sassl.log file, I can see the following:

=CRASH REPORT==== 23-Dec-2015::12:28:38 ===
  crasher:
    initial call: gen_smtp_server_session:init/1
    pid: <0.2637.0>
    registered_name: []
    exception exit: {{badmatch,
                         {error,
                             {{badmatch,undefined},
                              [{rabbit_message_sender,init,1,
                                   [{file,"src/rabbit_message_sender.erl"},
                                    {line,25}]},
                               {gen_server,init_it,6,
                                   [{file,"gen_server.erl"},{line,304}]},
                               {proc_lib,init_p_do_apply,3,
                                   [{file,"proc_lib.erl"},{line,227}]}]}}},
                     [{rabbit_email_handler,init,4,
                          [{file,"src/rabbit_email_handler.erl"},{line,30}]},
                      {gen_smtp_server_session,init,1,
                          [{file,
                               "../rabbitmq-gen-smtp/rabbitmq-gen-smtp-git/src/gen_smtp_server_session.erl"},
                           {line,120}]},
                      {gen_server,init_it,6,
                          [{file,"gen_server.erl"},{line,304}]},
                      {proc_lib,init_p_do_apply,3,
                          [{file,"proc_lib.erl"},{line,227}]}]}
      in function  gen_server:init_it/6 (gen_server.erl, line 328)
    ancestors: [<0.272.0>,<0.271.0>,<0.270.0>]
    messages: [{'EXIT',<0.2638.0>,
                      {{badmatch,undefined},
                       [{rabbit_message_sender,init,1,
                            [{file,"src/rabbit_message_sender.erl"},
                             {line,25}]},
                        {gen_server,init_it,6,
                            [{file,"gen_server.erl"},{line,304}]},
                        {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,227}]}]}}]
    links: []
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 1597
    stack_size: 24
    reductions: 447
  neighbours:

The configuration for the plugin I used was:

 {rabbitmq_email, [
        {server_config, [
                [{port, 2525}, {protocol, tcp}, {domain, "api-hypodroom"}, {address,{0,0,0,0}}]
        ]},
        {server_auth, false},
        {server_starttls, false},
        {email_domains,
                [{<<"dossiers.hypodroom.dev">>, {<<"/">>, <<"email-in">>}}
        ]},
        {email_queues,
                [{{<<"/">>, <<"email-out">>}, <<"dossiers.hypodroom.dev">>}
        ]},
        {client_sender, "noreply@example.com"}
  ]}

Is there something wrong with my configuration? Do you need more information from me to help me out?

Hello. The email_domains need to include the same domain that is included in the server_config. To fix that try to use e.g.

{server_config, [
   [{port, 2525}, {protocol, tcp}, {domain, "dossiers.hypodroom.dev"}, {address,{0,0,0,0}}]
]},

Thanks, that did the trick.

I'm now receiving the error that SMTP authentication is required, but I specified {server_auth, false}:

Dec 23 13:00:25 api-hypodroom postfix/smtp[731]: 8F6744059F: to=<a2743ace-214a-460c-badb-0aa568ed2c06@dossiers.hypodroom.dev>, relay=api-hypodroom[127.0.1.1]:2525, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (host api-hypodroom[127.0.1.1] said: 530 SMTP authentication is required (in reply to MAIL FROM command))

Never mind that last error; It's not in the configuration of this plugin. When sending a message via telnet, I succesfully received the message on a queue.

Ok, enjoy :-)