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
Extend ext_smtp.py #669
Extend ext_smtp.py #669
Conversation
1. Respect empty CC and BCC and do not deliver <> to SMTP Server 2. Allow TLS also on non-SSL sessions 3. Turn on debugging before TLS to see that log as well 4. Check for parameter `files` and empty if missed 5. Loop through files and append to attachments 6. Allow Attachment Disposition Name differ from Filename by path/filename.ext=attname.ext 7. Allow body to send in text and html by list or dict
Hi @derks please let me know if this does fit for you. Cheers |
Fix linter issues
Fix Linter
@TomFreudenberg I appreciate the PR, and don't see any immediate issues that would block this from merging in, however there is no test coverage. Ideally, running |
@TomFreudenberg I just realized covering this will be difficult due to the fact that the server needs to support TLS to test, and unit tests need to be portable. I will probably need to spend time analyzing how to 1. test TLS local and 2. test TLS with Travis. If you have ideas, please share... but I expect I'll need to spend time on it. Thank you either way. |
Hi @derks I am the maintainer of midi-smtp-server and there we have to check TLS as well. If you like, I can prepare some tests from or with that component. |
Thanks @TomFreudenberg I'll spend some time on this... I typically use Mailhog for local dev, and just need to test some things for Travis CI testing. |
@TomFreudenberg I've reviewed the changes and all appears to line up and make sense to me, except this chunk:
Is the support for string/list/dict I see this as a separate feature request and would like to separate that part out so that I fully understand the use-case/requirements, and add proper testing and documentation for it. Correct me if i'm wrong, but without mixing in the "how".... the feature request is:
Is that right? |
Hey @derks thanks for all your comments and effort on this. Yes:
To make it sure from the SMTP standard, you "never should" send out a HTML body message without a TEXT part even that this does work and is used a lot by marketing mail pages. The reason is that, a TEXT only client will see just an empty message if only a HTML body was attached. My idea in doing it this way (mixin body) was to be compatible for existing projects. For me it would also be fine if we add new arguments on the line if that fits better to your mind. I checked the PR with my latest changes in the project and update it. There will be just "plain" set as type for TEXT body. In case that you do not prefer mixin things, have you seen the variation for filenames and attachment dispositions as written in Point 6. of my starting comment? This aligns to Give me a note if you want to have more changes. |
@derks if you check the lines I wonder why you have created the special lines for "subject_prefix". Looking on that I would say it does fit also into the array of one of the above items: # some keyword args override configuration defaults
for item in ['to', 'from_addr', 'cc', 'bcc', 'subject']: From my point of view it should be appended into that? So there could be a config default but could be overwritten for some messages as well? I came up here while thinking about a default for files. Wouldn't it make sense as well to add a default for So I would end up here: # some keyword args override configuration defaults
for item in ['to', 'from_addr', 'cc', 'bcc', 'subject', 'subject_prefix', 'files']: |
The last change allows to config subject_prefix and files using config_defaults or config_file |
@TomFreudenberg I can work with this... everything makes sense and just need to do some work for test coverage, etc. I've realized testing for the SMTP extension is heavily mocked so going to work on getting it going through real testing. Might modify the above somewhat, but will ensure it meets your use case. Will get this merged in as soon as I can. |
Hi @derks thanks for your feedback, I am not in hurry. Currently I deliver an own smtp_ext.py on tokeo, so all is covered. Offtopic: Thanks for the great Cement, it is fun to work on that. Maybe you find the time about my question about dividing configs for production, testing and development in case that only a few settings are changed in between. |
files
and empty if missedCovered Issues: