# Imported (sent) messages don't show in the mailbox

**URL:** <https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527>\
**Category:** Product Support\
**Created:** [March 2, 2019, 9:13pm UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527 "2019-03-02T21:13:16Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![nmcgovern](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmcgovern/32/132630_2.png) [@nmcgovern](https://meta.discourse.org/u/nmcgovern)\
**Post date:** [March 2, 2019, 9:13pm UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527/1 "2019-03-02T21:13:16Z")

</div>

Hi all,

I’m trying to migrate a rather large site over to discourse from some sort of terrible mix of joomla plugins. The good news is that I’ve got sorted most of the items, except for private messages.

I get a list of all private messages from mysql, call `create_posts(result_map, total_count, offset)` on the result.

For posts without a parent, I set

- `:archetype = Archetype.private_message`
- `:title = # first line of the message`
- `:target_usernames = fromusername,tousername`

As I understand it, this should make `PostCreator` create a topic first, and then a post for that topic.

This is indeed what happens. However, when I view my mailbox, the message doesn’t appear.  
Looking in postgres, the topic is indeed created, it has the right archetype (private\_message) and subtype (user\_to\_user), deleted\_at is nil, and closed/archived are both false.  
This matches another message I sent via the web interface to see if there was a disparity.  
I’ve verified that the right `user_id`s are in `topic_allowed_users`.

I initially thought it may have something to do with the older date it was imported, but I’ve tried looking through the source of `TopicQuery`, and can’t seem to see anything immediately that would prevent these from turning up.

Does anyone have any ideas on this?

(As an aside, it seems that `PostCreator` failing to add the right topic\_allowed\_users because _possibly I may_ have been passing `user_ids` rather than `username`s does so silently, rather than populating `post_creator.errors.full_messages`. `post` simply becomes a string with the error message. I’ll open a bug about this)

---

_[View the full topic](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527)._
