github.com/status-im/status-go@v1.1.0/mailserver/README.md (about)

     1  MailServer
     2  ==========
     3  
     4  This document is meant to collect various information about our MailServer implementation.
     5  
     6  ## Syncing between mail servers
     7  
     8  It might happen that one mail server is behind other due to various reasons like a machine being down for a few minutes etc.
     9  
    10  There is an option to fix such a mail server:
    11  1. SSH to a machine where this broken mail server runs,
    12  2. Add a mail server from which you want to sync:
    13  ```
    14  # sudo might be not needed in your setup
    15  $ echo '{"jsonrpc":"2.0","method":"admin_addPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    16      sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
    17  ```
    18  3. Mark it as a trusted peer:
    19  ```
    20  # sudo might be not needed in your setup
    21  $ echo '{"jsonrpc":"2.0","method":"shh_markTrustedPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    22      sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
    23  ```
    24  4. Finally, trigger the sync command:
    25  ```
    26  # sudo might be not needed in your setup
    27  $ echo '{"jsonrpc":"2.0","method":"shhext_syncMessages","params":[{"mailServerPeer":"enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504", "to": 1550479953, "from": 1550393583, "limit": 1000}],"id":1}' | \
    28      sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
    29  ```
    30  
    31  You can add `"followCursor": true` if you want it to automatically download messages until the cursor is empty meaning all data was synced.
    32  
    33  ### Debugging
    34  
    35  To verify that your mail server received any responses, watch logs and seek for logs like this:
    36  ```
    37  INFO [02-18|09:08:54.257] received sync response count=217 final=false err= cursor=[]
    38  ```
    39  
    40  And it should finish with:
    41  ```
    42  INFO [02-18|09:08:54.431] received sync response count=0 final=true err= cursor=[]
    43  ```