# Every email should have a unique Message-ID

**URL:** <https://meta.discourse.org/t/every-email-should-have-a-unique-message-id/92746>\
**Category:** Bug\
**Tags:** email\
**Created:** [19.Июль.2018 19:02:05 UTC](https://meta.discourse.org/t/every-email-should-have-a-unique-message-id/92746 "2018-07-19T19:02:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [19.Июль.2018 19:02:05 UTC](https://meta.discourse.org/t/every-email-should-have-a-unique-message-id/92746/1 "2018-07-19T19:02:05Z")

</div>

Every single email that Discourse generates [must have a unique Message-ID](https://tools.ietf.org/html/rfc2822#section-3.6.4).

The current IDs we generate are not unique - the same Message-ID will get used for every distinct email going out for a particular post (i.e. if it’s sent to 10 users, that Message-ID gets repeated 10 times):

```ruby
            if post.post_number == 1
              "<topic/#{topic_id}@#{host}>"
            else
              "<topic/#{topic_id}/#{post.id}@#{host}>"
            end

```

⬇

```plaintext
Message-ID: <topic/3981/53574@meta.discourse.org>

```

We should append some randomness onto the Message ID (which we can obviously remove when parsing incoming email).

---

_[View the full topic](https://meta.discourse.org/t/every-email-should-have-a-unique-message-id/92746)._
