Skip to content

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

License

Notifications You must be signed in to change notification settings

jtalks-org/pochta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

####Installation

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 --> [email protected]. 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": "\/127.0.0.1:54642",
    "mail_body": "From: [email protected]\r\nTo: [email protected]\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": "[email protected]",
    "delivery_date": "Mon Apr 28 23:51:10 MSK 2014",
    "envelope_recipients": ["[email protected]"]
  }
]

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages