Twake mails aren't sent

Hi,

I’m having an issue with email. I configured SMTP parameters in Parameters.php, but mails aren’t sent.

I checked queues with docker-compose exec rabbitmq rabbitmqctl list_queues name messages messages_ready state, everything seems fine (messages in mail queue listed and ready).

I also checked docker-compose logs, and I haven’t seen even a hint of an error.

Any idea about that ? :thinking:

Thanks ! :slight_smile:
Philippe

Hello,
to check the errors try this procedure:

  1. sudo docker-compose exec php php bin/console twake:mails_queue (will run for 1 minute)
  2. Add a secondary email / invite someone by email

(retry adding secondary mail multiple time to fill up the queue to be sure to intercept the error as if an error occur on a mail task it is delayed for 1 minute and there is an other consumer running in background)

Hi,

Thanks ! I tried it, got this error :

Fatal error: Uncaught Swift_SwiftException: Unable to load DKIM Private Key [error:0607A082:digital envelope routines:EVP_CIPHER_CTX_ set_key_length:invalid key length] in /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php on line 675

Swift_SwiftException: Unable to load DKIM Private Key [error:0607A082:digital envelope routines:EVP_CIPHER_CTX_set_key_length:invalid  key length] in /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php on line 675

I didn’t have configured dkim, and thought the block in Parameters.php could be left empty. Then I commented it, executed docker-compose restart, and retried, but the issue still occurs :thinking:

Here is the complete stacktrace :

Call Stack:
    0.0002     350744   1. {main}() /twake-core/bin/console:0
    0.0669    2966624   2. App\App->runCli() /twake-core/bin/console:9
    0.0669    2967080   3. Common\CommandsManager->run() /twake-core/app/App.php:134
    0.0669    2968792   4. Common\CommandsManager->execute() /twake-core/app/Common/CommandsManager.php:27
    0.0677    2985824   5. Twake\Core\Command\MailsQueueCommand->executeFromManager() /twake-core/app/Common/CommandsManager.php:46
    0.0677    2985824   6. Twake\Core\Command\MailsQueueCommand->execute() /twake-core/app/Common/Commands/ContainerAwareCommand.php: 27
   21.4116    8465976   7. Twake\Core\Services\TwakeMailer->sendInternal() /twake-core/src/Twake/Core/Command/MailsQueueCommand.php:6 6
   21.4298    9283392   8. Twake\Core\Services\TwakeMailer->sendHtml() /twake-core/src/Twake/Core/Services/TwakeMailer.php:95
   21.4834   11078552   9. Swift_Mailer->send() /twake-core/src/Twake/Core/Services/TwakeMailer.php:151
   21.8575   11103232  10. Swift_SmtpTransport->send() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php:71
   21.8583   11111592  11. Swift_SmtpTransport->sendTo() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Abstr actSmtpTransport.php:206
   21.8583   11111968  12. Swift_SmtpTransport->doMailTransaction() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Tran sport/AbstractSmtpTransport.php:516
   21.9756   11111968  13. Swift_SmtpTransport->streamMessage() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transpor t/AbstractSmtpTransport.php:500
   21.9761   11118448  14. Swift_Message->toByteStream() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Abstr actSmtpTransport.php:398
   21.9779   11122280  15. Swift_Message->doSign() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php:169
   22.0229   11125736  16. Swift_Signers_DKIMSigner->addSignature() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mess age.php:203
   22.0234   11128096  17. Swift_Signers_DKIMSigner->getEncryptedHash() /twake-core/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ Signers/DKIMSigner.php:551

Do you want that I push an issue on github ?

Philippe

Yes an issue on github would be appropriate, it’s on me this time we did not implemented the case where DKIM is not defined!

Alright, I will push it then :thinking:

Thanks for your time, sincerly ! :clap:

Philippe

Here we are ! :grin:

For reference :

https://github.com/TwakeApp/Twake/issues/88

Philippe

Here is the complete stacktrace

> Fatal error: Uncaught PhpAmqpLib\Exception\AMQPIOException: stream_socket_client(): unable to connect to tcp://rabbitmq:5672 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /twake-core/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php on line 110
> 
> PhpAmqpLib\Exception\AMQPIOException: stream_socket_client(): unable to connect to tcp://rabbitmq:5672 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /twake-core/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php on line 110
> 
> Call Stack:
>     0.0001     350744   1. {main}() /twake-core/bin/console:0
>     0.0832    3034960   2. App\App->runCli() /twake-core/bin/console:9
>     0.0832    3035416   3. Common\CommandsManager->run() /twake-core/app/App.php:139
>     0.0832    3037128   4. Common\CommandsManager->execute() /twake-core/app/Common/CommandsManager.php:27
>     0.0838    3054128   5. Twake\Core\Command\MailsQueueCommand->executeFromManager() /twake-core/app/Common/CommandsManager.php:46
>     0.0838    3054128   6. Twake\Core\Command\MailsQueueCommand->execute() /twake-core/app/Common/Commands/ContainerAwareCommand.php:27
>     0.3733    6366864   7. Twake\Core\Services\Queues\Adapters\RabbitMQ->consume() /twake-core/src/Twake/Core/Command/MailsQueueCommand.php:45
>     0.3733    6367584   8. Twake\Core\Services\Queues\Adapters\RabbitMQ->getChannel() /twake-core/src/Twake/Core/Services/Queues/Adapters/RabbitMQ.php:66
>     0.3792    6644240   9. PhpAmqpLib\Connection\AMQPStreamConnection->__construct() /twake-core/src/Twake/Core/Services/Queues/Adapters/RabbitMQ.php:25
>     0.3814    6728528  10. PhpAmqpLib\Connection\AMQPStreamConnection->__construct() /twake-core/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AMQPStreamConnection.php:70
>     0.5475    6907088  11. PhpAmqpLib\Connection\AMQPStreamConnection->connect() /twake-core/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php:217

Thank you Jenis
Do you have the logs for RabbitMQ ?
docker-compose logs -f --tail 100 rabbitmq

It give me this type of error

rabbitmq_1 | 2020-10-30 08:34:52.538 [info] <0.12654.0> accepting AMQP connection <0.12654.0> (192.168.0.123:13438 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:34:52.539 [error] <0.12654.0> closing AMQP connection <0.12654.0> (192.168.0.123:13438 -> 172.18.0.4:5672):
rabbitmq_1 | {bad_header,<<“GET / HT”>>}
rabbitmq_1 | 2020-10-30 08:34:53.654 [info] <0.12657.0> accepting AMQP connection <0.12657.0> (192.168.0.123:13439 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:34:53.654 [error] <0.12657.0> closing AMQP connection <0.12657.0> (192.168.0.123:13439 -> 172.18.0.4:5672):
rabbitmq_1 | {bad_header,<<“GET / HT”>>}
rabbitmq_1 | 2020-10-30 08:34:58.720 [info] <0.12661.0> accepting AMQP connection <0.12661.0> (192.168.0.123:13441 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:34:58.721 [error] <0.12661.0> closing AMQP connection <0.12661.0> (192.168.0.123:13441 -> 172.18.0.4:5672):
rabbitmq_1 | {bad_header,<<“GET / HT”>>}
rabbitmq_1 | 2020-10-30 08:35:01.925 [info] <0.12665.0> accepting AMQP connection <0.12665.0> (172.18.0.6:34438 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:01.950 [info] <0.12665.0> connection <0.12665.0> (172.18.0.6:34438 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.133 [info] <0.12568.0> closing AMQP connection <0.12568.0> (172.18.0.6:34412 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)
rabbitmq_1 | 2020-10-30 08:35:02.168 [info] <0.12675.0> accepting AMQP connection <0.12675.0> (172.18.0.6:34444 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:02.219 [info] <0.12675.0> connection <0.12675.0> (172.18.0.6:34444 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.353 [info] <0.12588.0> closing AMQP connection <0.12588.0> (172.18.0.6:34422 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)
rabbitmq_1 | 2020-10-30 08:35:02.523 [info] <0.12609.0> closing AMQP connection <0.12609.0> (172.18.0.6:34434 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)
rabbitmq_1 | 2020-10-30 08:35:02.525 [info] <0.12624.0> closing AMQP connection <0.12624.0> (172.18.0.6:34436 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)
rabbitmq_1 | 2020-10-30 08:35:02.533 [info] <0.12687.0> accepting AMQP connection <0.12687.0> (172.18.0.6:34452 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:02.649 [info] <0.12687.0> connection <0.12687.0> (172.18.0.6:34452 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.833 [info] <0.12696.0> accepting AMQP connection <0.12696.0> (172.18.0.6:34456 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:02.874 [info] <0.12699.0> accepting AMQP connection <0.12699.0> (172.18.0.6:34458 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:02.875 [info] <0.12696.0> connection <0.12696.0> (172.18.0.6:34456 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.920 [info] <0.12699.0> connection <0.12699.0> (172.18.0.6:34458 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.935 [info] <0.12710.0> accepting AMQP connection <0.12710.0> (172.18.0.6:34460 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:02.976 [info] <0.12710.0> connection <0.12710.0> (172.18.0.6:34460 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:02.984 [info] <0.12719.0> accepting AMQP connection <0.12719.0> (172.18.0.6:34462 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:03.002 [info] <0.12719.0> connection <0.12719.0> (172.18.0.6:34462 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:03.058 [info] <0.12732.0> accepting AMQP connection <0.12732.0> (172.18.0.6:34464 -> 172.18.0.4:5672)
rabbitmq_1 | 2020-10-30 08:35:03.067 [info] <0.12732.0> connection <0.12732.0> (172.18.0.6:34464 -> 172.18.0.4:5672): user ‘admin’ authenticated and granted access to vhost ‘/’
rabbitmq_1 | 2020-10-30 08:35:07.972 [info] <0.12699.0> closing AMQP connection <0.12699.0> (172.18.0.6:34458 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)
rabbitmq_1 | 2020-10-30 08:35:08.085 [info] <0.12732.0> closing AMQP connection <0.12732.0> (172.18.0.6:34464 -> 172.18.0.4:5672, vhost: ‘/’, user: ‘admin’)

Is there a solution to this? I have some difficulties in setting up sending email.