New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEFAULT_FROM_EMAIL to common.py settings #128

Closed
okainov opened this Issue Nov 30, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@okainov
Contributor

okainov commented Nov 30, 2017

Description of problem

common.py settings for email are not full. Field DEFAULT_FROM_EMAIL is missing, but it's required for sending emails. So common.py settings should look like:

EMAIL_HOST = ''
EMAIL_PORT = 25
EMAIL_FROM = '<insert_email>'
DEFAULT_FROM_EMAIL = '<insert_email>'
EMAIL_SUBJECT_PREFIX = '[Kiwi-TCMS] '

Component (web, API, etc)

core

Version or commit hash (if applicable)

latest

How often reproducible

always

atodorov added a commit that referenced this issue Nov 30, 2017

Rename EMAIL_FROM to DEFAULT_FROM_EMAIL. Fixes #128
DEFAULT_FROM_EMAIL is the standard name for this setting and is
used by other Django apps/email backends.

There's no point for us keeping a setting with a different name!

atodorov added a commit that referenced this issue Nov 30, 2017

Rename EMAIL_FROM to DEFAULT_FROM_EMAIL. Fixes #128
DEFAULT_FROM_EMAIL is the standard name for this setting and is
used by other Django apps/email backends.

There's no point for us keeping a setting with a different name!

@atodorov atodorov closed this in 5be0675 Nov 30, 2017

@okainov

This comment has been minimized.

Show comment
Hide comment
@okainov

okainov Nov 30, 2017

Contributor

@atodorov are you sure that it will work w\o EMAIL_FROM? I didn't investigate it, but when I just changed EMAIL_FROM to DEFAULT_FROM_EMAIL, something appeared to be broken, so I had to leave both options

Contributor

okainov commented Nov 30, 2017

@atodorov are you sure that it will work w\o EMAIL_FROM? I didn't investigate it, but when I just changed EMAIL_FROM to DEFAULT_FROM_EMAIL, something appeared to be broken, so I had to leave both options

@atodorov

This comment has been minimized.

Show comment
Hide comment
@atodorov

atodorov Nov 30, 2017

Member

@GodfatherThe see the diff in the commit. Kiwi TCMS internally never used DEFAULT_FROM_EMAIL but instead used EMAIL_FROM and also EMAIL_HOST to figure out whether or not to send email.

The commit changes this and makes Kiwi use only DEFAULT_FROM_EMAIL. Depending on the email backend you are using you may still need to configure EMAIL_HOST, EMAIL_PORT, EMAIL_USERNAME, etc.

Member

atodorov commented Nov 30, 2017

@GodfatherThe see the diff in the commit. Kiwi TCMS internally never used DEFAULT_FROM_EMAIL but instead used EMAIL_FROM and also EMAIL_HOST to figure out whether or not to send email.

The commit changes this and makes Kiwi use only DEFAULT_FROM_EMAIL. Depending on the email backend you are using you may still need to configure EMAIL_HOST, EMAIL_PORT, EMAIL_USERNAME, etc.

@calvinmqc

This comment has been minimized.

Show comment
Hide comment
@calvinmqc

calvinmqc Feb 23, 2018

@GodfatherThe @atodorov

I added the following settings in the file below:
/venv/lib/python3.5/site-packages/tcms/settings/common.py

EMAIL_HOST = 'smtp.xxx.com'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'kiwi@xxx.com'
EMAIL_SUBJECT_PREFIX = '[Kiwi-TCMS] '

Then I went back to the website and tried to add a test run, but no email was sent out.
I also tried to register a new account and the new account did not receive any email too.

I am wondering if I missed any settings here? Or I need to run some commands after I updated the common.py file to start the email service?

Thanks a lot for your suggestions!

calvinmqc commented Feb 23, 2018

@GodfatherThe @atodorov

I added the following settings in the file below:
/venv/lib/python3.5/site-packages/tcms/settings/common.py

EMAIL_HOST = 'smtp.xxx.com'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'kiwi@xxx.com'
EMAIL_SUBJECT_PREFIX = '[Kiwi-TCMS] '

Then I went back to the website and tried to add a test run, but no email was sent out.
I also tried to register a new account and the new account did not receive any email too.

I am wondering if I missed any settings here? Or I need to run some commands after I updated the common.py file to start the email service?

Thanks a lot for your suggestions!

@okainov

This comment has been minimized.

Show comment
Hide comment
@okainov

okainov Feb 24, 2018

Contributor

@calvinmqc for me it's working good. Could you check the logs from the server\sendmail? Can it be that your smtp server is blocking emails? Did you restart Django after changing settings?
BTW modifying the file in Docker directly is not a supposed way. You should modify your code from outside and then make image again.

Contributor

okainov commented Feb 24, 2018

@calvinmqc for me it's working good. Could you check the logs from the server\sendmail? Can it be that your smtp server is blocking emails? Did you restart Django after changing settings?
BTW modifying the file in Docker directly is not a supposed way. You should modify your code from outside and then make image again.

@atodorov

This comment has been minimized.

Show comment
Hide comment
@atodorov

atodorov Feb 24, 2018

Member

@calvinmqc please see the Django email documentation:
https://docs.djangoproject.com/en/2.0/topics/email/#quick-example

there could be tons of things that can go wrong depending on your environment and chosen email backend so consult the logs to get an idea what's happening.

The best way to modify settings is to create a file outside the container and then use the docker-compose.yml file to mount your local file under /venv/lib/python3.5/site-packages/tcms/settings/product.py inside the container.

Member

atodorov commented Feb 24, 2018

@calvinmqc please see the Django email documentation:
https://docs.djangoproject.com/en/2.0/topics/email/#quick-example

there could be tons of things that can go wrong depending on your environment and chosen email backend so consult the logs to get an idea what's happening.

The best way to modify settings is to create a file outside the container and then use the docker-compose.yml file to mount your local file under /venv/lib/python3.5/site-packages/tcms/settings/product.py inside the container.

@calvinmqc

This comment has been minimized.

Show comment
Hide comment
@calvinmqc

calvinmqc Feb 26, 2018

@GodfatherThe

Thanks for your comments. I will contact our IT team to verify the SMTP server log file. How do we restart Django in the Kiwi container? My understanding is that Django has been embedded into the Kiwi image?

calvinmqc commented Feb 26, 2018

@GodfatherThe

Thanks for your comments. I will contact our IT team to verify the SMTP server log file. How do we restart Django in the Kiwi container? My understanding is that Django has been embedded into the Kiwi image?

@okainov

This comment has been minimized.

Show comment
Hide comment
@okainov

okainov Feb 26, 2018

Contributor

What I meant by "restart" is

  • change sources
  • stop kiwi container
  • redeploy (make image)
  • start container
    So, restart both container and django. And don't change files inside container, change sources outside.
Contributor

okainov commented Feb 26, 2018

What I meant by "restart" is

  • change sources
  • stop kiwi container
  • redeploy (make image)
  • start container
    So, restart both container and django. And don't change files inside container, change sources outside.
@calvinmqc

This comment has been minimized.

Show comment
Hide comment
@calvinmqc

calvinmqc Feb 26, 2018

@GodfatherThe @atodorov

Thanks a lot for your help! Once I created a new product.py file outside the container, restart Kwi, it started to work properly!!

BTW, I am using the DEFAULT_FROM_EMAIL setting, EMAIL_FROM is not required.

calvinmqc commented Feb 26, 2018

@GodfatherThe @atodorov

Thanks a lot for your help! Once I created a new product.py file outside the container, restart Kwi, it started to work properly!!

BTW, I am using the DEFAULT_FROM_EMAIL setting, EMAIL_FROM is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment