• Dev
  • Blomstra Email Conversations: post via email to your Flarum forum

IanM You are right.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<p>Additionally, a 401 Unauthorized
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

IanM

OK the problem was a passwd for the whole website.

Now I can reply to a disscusion via mail.

But still can't make a new discusion when sending an email.

  • IanM replied to this.

    majkimajki yes I understand that.

    The entry in mailgun should be similar to this:

    match_recipient("email@test.com") Priority: 0
    
    store(notify="https://my.forum.com/api/email/receive")

    The notifiy is critical...

      majkimajki Now I can reply to a disscusion via mail.

      great!

      majkimajki But this can't make a new discusion...

      To start a new discussion, just send an email to your Forum.. The email title will become the discussion title, and email body will become the first post content

      IanM Mailgun says: "Failed to update route."

      When trying to add what you wrote.

      I can only add a URL there, nothing else wants to work.

      Thanks for the help, like I said, still not able to make new disscussion, don't know why.

      • IanM replied to this.

        majkimajki OK the problem was a passwd for the whole website.

        I just noticed this. So your entire forum is behind a basic auth challenge or similar?

        This will likely be why the Mailgun route did not setup properly, as Mailgun would have not been able to communicate with the Forum at that point.

        majkimajki When trying to add what you wrote.

        You must not edit the routes directly, they must be configured by Flarum. I shared that as an example of what to look for in the mailgun dashboard

        majkimajki like I said, still not able to make new disscussion, don't know why.

        I think until the password restriction is removed, at least from the /api/.... route on your forum, it will be difficult to make all this work correctly

          IanM
          I've deleted the basic auth, and re-created the route.

          It looks the same as before. Now testing without the basic auth, but still seem not to be able to create a discusion.

          Maybe some privileges need to be changed in the admin area?

          The route must work, because I can respond in a dissusion, so why can't I post a new one?

          Sorry to waste your time, but can't make this work 😉

          • IanM replied to this.

            majkimajki so why can't I post a new one?

            Do you use flarum/tags on this forum? If so, you must set a default tag for incoming mail new discussions to be assigned to, else it will be discarded. {FORUM_URL}/admin#/extension/blomstra-email-conversations

            Also, you must ensure that the user that you are starting a new discussion as does indeed have permission to start a new discussion

              IanM

              The: Incoming email new discussion tag

              Was set from the beggining, I've tried switching to other tags, but still no effect.

              Is there anyway I can debug this extension to see where it shows an error?

              If reply in a disscusion via email works, then making a new disscusion should work too, but I have no clue why it does not.

              "Also, you must ensure that the user that you are starting a new discussion as does indeed have permission to start a new discussion"

              You mean the email address I am sending the emails from? It's the same email as my admin account.

              Found this:

              [12-Aug-2022 15:29:07 UTC] PHP Warning: Undefined array key 1 in /home//public_html//vendor/blomstra/email-conversations/src/Jobs/ProcessReceivedEmail.php on line 135
              [12-Aug-2022 15:29:07 UTC] PHP Warning: Undefined array key 1 in /home//public_html//vendor/blomstra/email-conversations/src/Jobs/ProcessReceivedEmail.php on line 162

              Flarum core 1.4.0
              PHP version: 8.1.8
              MySQL version: 10.3.35-MariaDB
              Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, readline, Reflection, SPL, session, standard, bcmath, bz2, calendar, ctype, curl, dba, dom, enchant, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, exif, mysqlnd, odbc, PDO, pgsql, Phar, posix, pspell, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, xmlreader, imagick, memcached, Zend OPcache
              +-------------------------------------+--------------+--------+
              | Flarum Extensions | | |
              +-------------------------------------+--------------+--------+
              | ID | Version | Commit |
              +-------------------------------------+--------------+--------+
              | flarum-flags | v1.4.0 | |
              | flarum-tags | v1.4.0 | |
              | askvortsov-auto-moderator | v0.1.2 | |
              | flarum-lock | v1.4.0 | |
              | flarum-sticky | v1.4.0 | |
              | afrux-forum-widgets-core | v0.1.7 | |
              | flarum-suspend | v1.4.0 | |
              | flarum-subscriptions | v1.4.0 | |
              | fof-upload | 1.2.3 | |
              | flarum-mentions | v1.4.0 | |
              | flarum-approval | v1.4.0 | |
              | blomstra-conversations | 0.1.0-beta.2 | |
              | v17development-user-badges | v1.1.0 | |
              | v17development-seo | v1.8.0 | |
              | v17development-blog | v0.6.3 | |
              | the-turk-stickiest | 3.0.1 | |
              | sycho-profile-cover | v1.3.3 | |
              | sycho-advanced-extension-categories | v0.1.3 | |
              | rob006-lang-polish | v0.5.28 | |
              | noriods-auto-more | v1.0.0 | |
              | justoverclock-welcomebox | 1.3.7 | |
              | ianm-synopsis | 1.2.1 | |
              | ianm-syndication | 1.2.1 | |
              | ianm-html-head | 1.1.0 | |
              | fof-user-bio | 1.1.0 | |
              | fof-socialprofile | 1.1.4 | |
              | fof-sitemap | 1.0.3 | |
              | fof-profile-image-crop | 1.0.1 | |
              | fof-polls | 1.1.0 | |
              | fof-nightmode | 1.4.1 | |
              | fof-links | 1.1.1 | |
              | fof-gamification | 1.4.5 | |
              | fof-formatting | 1.0.2 | |
              | fof-follow-tags | 1.1.5 | |
              | fof-discussion-thumbnail | 1.1.0 | |
              | fof-default-user-preferences | 1.1.1 | |
              | fof-default-group | 1.1.0 | |
              | flarum-statistics | v1.4.0 | |
              | flarum-markdown | v1.4.0 | |
              | flarum-lang-english | v1.4.0 | |
              | flarum-emoji | v1.4.0 | |
              | flarum-bbcode | v1.4.0 | |
              | datlechin-title-length | v0.1.1 | |
              | datlechin-link-preview | v1.0.0 | |
              | datlechin-discussion-count | v0.1.0 | |
              | darkle-fancybox | 1.1.2 | |
              | clarkwinkelmann-circle-groups | 1.0.1 | |
              | blomstra-usercard-stats | 0.1.2 | |
              | blomstra-email-conversations | 0.1.0-beta.4 | |
              | afrux-news-widget | v0.1.1 | |
              +-------------------------------------+--------------+--------+

              IanM

              Some more I found today, thanks for the help!

              [14-Aug-2022 14:47:39 UTC] PHP Fatal error: Uncaught Error: Call to undefined method Extiverse\Mercury\Notification\ExtensionUpdatesBlueprint::getSubject() in /home/ /public_html/ /vendor/blomstra/email-conversations/src/NotificationMailerWithId.php:52
              Stack trace:
              #0 /home/ /public_html/ /vendor/blomstra/email-conversations/src/NotificationMailerWithId.php(37): Blomstra\EmailConversations\NotificationMailerWithId->addIdToContent(Object(Extiverse\Mercury\Notification\ExtensionUpdatesBlueprint), Object(Flarum\User\User))
              #1 /home/ /public_html/ /vendor/extiverse/mercury/src/Job/SendExtensionUpdatesNotification.php(33): Blomstra\EmailConversations\NotificationMailerWithId->send(Object(Extiverse\Mercury\Notification\ExtensionUpdatesBlueprint), Object(Flarum\User\User))
              #2 /home/ /public_html/ /vendor/illuminate/database/Concerns/BuildsQueries.php(96): Extiverse\Mercury\Job\SendExtensionUpdatesNotification->Extiverse\Mercury\Job\{closure}(Object(Flarum\User\User), 0)
              #3 /home/ /public_html/ /vendor/illuminate/database/Concerns/BuildsQueries.php(51): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Concerns\{closure}(Object(Illuminate\Database\Eloquent\Collection), 1)
              #4 /home/ /public_html/ /vendor/illuminate/database/Concerns/BuildsQueries.php(100): Illuminate\Database\Eloquent\Builder->chunk(1000, Object(Closure))
              #5 /home/ /public_html/ /vendor/extiverse/mercury/src/Job/SendExtensionUpdatesNotification.php(34): Illuminate\Database\Eloquent\Builder->each(Object(Closure))
              #6 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(36): Extiverse\Mercury\Job\SendExtensionUpdatesNotification->handle(Object(Blomstra\EmailConversations\NotificationMailerWithId))
              #7 /home/ /public_html/ /vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
              #8 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
              #9 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Container\Container), Array, Object(Closure))
              #10 /home/ /public_html/ /vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Container\Container), Array, Array, NULL)
              #11 /home/ /public_html/ /vendor/illuminate/bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
              #12 /home/ /public_html/ /vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #13 /home/ /public_html/ /vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #14 /home/ /public_html/ /vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
              #15 /home/ /public_html/ /vendor/illuminate/queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification), false)
              #16 /home/ /public_html/ /vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #17 /home/ /public_html/ /vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #18 /home/ /public_html/ /vendor/illuminate/queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
              #19 /home/ /public_html/ /vendor/illuminate/queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\SyncJob), Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #20 /home/ /public_html/ /vendor/illuminate/queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\SyncJob), Array)
              #21 /home/ /public_html/ /vendor/illuminate/queue/SyncQueue.php(47): Illuminate\Queue\Jobs\Job->fire()
              #22 /home/ /public_html/ /vendor/extiverse/mercury/src/Console/Command/CheckingUpdatesCommand.php(59): Illuminate\Queue\SyncQueue->push(Object(Extiverse\Mercury\Job\SendExtensionUpdatesNotification))
              #23 /home/ /public_html/ /vendor/extiverse/mercury/src/Console/Command/CheckingUpdatesCommand.php(41): Extiverse\Mercury\Console\Command\CheckingUpdatesCommand->notify(Object(Illuminate\Support\Collection))
              #24 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(36): Extiverse\Mercury\Console\Command\CheckingUpdatesCommand->handle(Object(Flarum\Extension\ExtensionManager), Object(Flarum\Settings\DefaultSettingsRepository))
              #25 /home/ /public_html/ /vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
              #26 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
              #27 /home/ /public_html/ /vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Container\Container), Array, Object(Closure))
              #28 /home/ /public_html/ /vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Container\Container), Array, Array, NULL)
              #29 /home/ /public_html/ /vendor/illuminate/console/Command.php(136): Illuminate\Container\Container->call(Array)
              #30 /home/ /public_html/ /vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
              #31 /home/ /public_html/ /vendor/illuminate/console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
              #32 /home/ /public_html/ /vendor/symfony/console/Application.php(1042): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
              #33 /home/ /public_html/ /vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Extiverse\Mercury\Console\Command\CheckingUpdatesCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
              #34 /home/ /public_html/ /vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
              #35 /home/ /public_html/ /vendor/flarum/core/src/Console/Server.php(42): Symfony\Component\Console\Application->run()
              #36 /home/ /public_html/ /flarum(24): Flarum\Console\Server->listen()
              #37 {main}
              thrown in /home/ /public_html/ /vendor/blomstra/email-conversations/src/NotificationMailerWithId.php on line 52
              [14-Aug-2022 14:49:39 UTC] PHP Warning: Undefined array key 1 in /home/ /public_html/ /vendor/blomstra/email-conversations/src/Jobs/ProcessReceivedEmail.php on line 135
              [14-Aug-2022 14:49:39 UTC] PHP Warning: Undefined array key 1 in /home/ /public_html/ /vendor/blomstra/email-conversations/src/Jobs/ProcessReceivedEmail.php on line 162

                5 days later

                IanM
                Have you had any luck reading the errors I posted?

                Your help was appreciated!

                djemyjenab integrating with telegram, whatsapp and perhaps other communication channels is what made us decide to generalize the implementation and.. that's very much possible! We can even build it (on your behalf), just check https://blomstra.net/development for more information.

                majkimajki I made a PR to fix this just a few minutes ago 😉