The best solution to deal with emails locally is Mailcatcher. The blog defines the setup of mailcatcher and configure it into Django.
Mailcatcher provides you with a local SMTP server for sending and receiving emails, that sent by your web application, it provides you a clean and simple email display for testing.
1. Use following command to install mailcatcher in your local system, you can install mailcatcher by only one command, Mailcatcher is available as a ruby gem.
1. Install rbenv and ruby-build
2. Install latest ruby 2.x
3. Set latest ruby as the global ruby (optional)
4. Install bundler
5. Install mailcatcher in the yougotagift project
6. Edit settings_local.py with the following code
Mailcatcher provides you with a local SMTP server for sending and receiving emails, that sent by your web application, it provides you a clean and simple email display for testing.
Install Mailcatcher (Quick and Dirty)
1. Use following command to install mailcatcher in your local system, you can install mailcatcher by only one command, Mailcatcher is available as a ruby gem.
$ sudo gem install mailcatcher2. Now Mail catcher is installed in your system you can verify by using the following command
$ mailcatcher --version3. Edit settings.py file of your django project with the following code
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'4. Run the following command where ./manage.py exists in your project
EMAIL_HOST = '127.0.0.1'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 1025
EMAIL_USE_TLS = False
$ workon yourproject5. You can reach it though your browser by opening http://localhost:1080/
$ honcho start mailcatcher
Install Mailcatcher (Long and Cleaner)
1. Install rbenv and ruby-build
$ brew install rbenv ruby-build
2. Install latest ruby 2.x
3. Set latest ruby as the global ruby (optional)
4. Install bundler
$ gem install bundler
5. Install mailcatcher in the yougotagift project
$ workon yourproject
$ bundle
$ honcho start (django development server, mailcatcher, celery workers and beat)
6. Edit settings_local.py with the following code
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'7. You can reach it though your browser by opening http://localhost:1080/
EMAIL_HOST = '127.0.0.1'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 1025
EMAIL_USE_TLS = False
This is why it is better that you should linked review before developing. It is possible to post superior send that way. Logo Designer
ReplyDelete