Send and Receive E-mails in Development
Cozy apps let users share documents from cozy to cozy.
Meet Alice and Bob. Alice wants to share a folder with Bob. Alice clicks on the share button and fills in the email input with Bob’s email address. Bob receives an email with a « Accept the sharing » button. Bob clicks on that button and is redirected to Alice’s cozy to enter his own cozy url to link both cozys. Bob sees Alice’s shared folder in his own cozy.
🤔 But how could we do this scenario on development environment?
With the docker image¶
If cozy-stack has to send an email, MailHog catches it and exposes it on its web interface on http://cozy.tools:8025/.
With the binary cozy-stack¶
./cozy-stack serve --appdir drive:../cozy-drive/build,settings:../cozy-settings/build --mail-disable-tls --mail-port 1025
Then simply run
MailHog and open http://cozy.tools:8025/.
Retrieve sent emails¶
With MailHog, every email sent by cozy-stack is caught. That means the email address does not have to be a real one, ie.
firstname.lastname@example.org are perfectly fine. It could be a real one, but the email will not reach the real recipient’s inbox, say