Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

JTalks Pochta

Fake Mail Server (Mail Stub) that is useful when testing your applications. It's like Russian Post Office (Pochta) - things get in, but they never get delivered. Cases when you may need it:

  • You write System tests against the app that sends mails to its users. You'd like to intercept those message to test them or to go through the workflow in automated manner.
  • You have a PROD database with all its users, you're eager to test your new version of the app on this DB but you're afraid mails will be delivered to real users.


Note, that during the first startup a folder ~/.pochta is created with the default configuration. You can change the configuration to match your needs: http/smtp ports, mailboxes and passwords.

####Usage Now, imagine your app sends mail to its users using Pochta SMTP Server: SUT --> Pochta --> After the mail was sent to Pochta it doesn't actually deliver the message to the end user, but rather Pochta stores it. Now in tests you can get the list of mails with the content e.g. by following: localhost:9000/inboxes/user?token=secret and the returned content may look like this:

    "server_id": 1,
    "sender_ip": "\/",
    "mail_body": "From:\r\nTo:\r\nMessage-ID: <1722681408.0.1398714670448.JavaMail.sbashkyrtsev@sbashkyrtsev-nb.local>\r\nSubject: This is the long  long long long long long long longSubject Line!\r\nMIME-Version: 1.0\r\nContent-Type: text\/plain; charset=us-ascii\r\nContent-Transfer-Encoding: 7bit\r\n\r\nThis is actual message\r\n",
    "envelope_from": "",
    "delivery_date": "Mon Apr 28 23:51:10 MSK 2014",
    "envelope_recipients": [""]

You can create new mailboxes in config file, while configuring them you should specify both mailbox and the password. When trying to use Pochta as SMTP Server, specify these credentials. Afterwards when you try to retreive stored data from Pochta, pass the password as a ?secret=password. Well, you should see self explanatory errors if you're doing something wrong.


Fake Mail Server (Mail Stub) that is useful when testing your applications.




No releases published
You can’t perform that action at this time.