forked from extern/django-helpdesk
Merge pull request #777 from auto-mat/abs-paths1
Don't use file paths when sending emails because they don't work on S3
This commit is contained in:
commit
86444e2bc7
@ -100,13 +100,10 @@ def send_templated_mail(template_name,
|
||||
|
||||
if files:
|
||||
for filename, filefield in files:
|
||||
mime = mimetypes.guess_type(filename)
|
||||
if mime[0] is not None and mime[0] == "text/plain":
|
||||
with open(filefield.path, 'r') as attachedfile:
|
||||
content = attachedfile.read()
|
||||
msg.attach(filename, content)
|
||||
else:
|
||||
msg.attach_file(filefield.path)
|
||||
filefield.open('rb')
|
||||
content = filefield.read()
|
||||
msg.attach(filename, content)
|
||||
filefield.close()
|
||||
logger.debug('Sending email to: {!r}'.format(recipients))
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user