diff options
author | Akshen | 2019-05-14 15:37:35 +0530 |
---|---|---|
committer | GitHub | 2019-05-14 15:37:35 +0530 |
commit | dc11054a26d4033e6c302b714cf319ea6c9a468c (patch) | |
tree | 6701c70ea2139ce1d4aa9cf271119c6dcb918643 /fossee_manim/send_mails.py | |
parent | e81af85e2427f70ad1f2055d8d9f17f00690693f (diff) | |
parent | f5f525368c6054c31abf6c0ff786a31b2a388661 (diff) | |
download | FOSSEE_animations-dc11054a26d4033e6c302b714cf319ea6c9a468c.tar.gz FOSSEE_animations-dc11054a26d4033e6c302b714cf319ea6c9a468c.tar.bz2 FOSSEE_animations-dc11054a26d4033e6c302b714cf319ea6c9a468c.zip |
Merge pull request #11 from Akshen/develop
2nd Proposal Form Button
Diffstat (limited to 'fossee_manim/send_mails.py')
-rw-r--r-- | fossee_manim/send_mails.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fossee_manim/send_mails.py b/fossee_manim/send_mails.py index 93841f2..a35f6f4 100644 --- a/fossee_manim/send_mails.py +++ b/fossee_manim/send_mails.py @@ -131,3 +131,27 @@ def send_email(request, call_on, contributor=None, key=None, proposal=None): send_mail( "FOSSEE Animation Comment by Reviewer", message, SENDER_EMAIL, [contributor.profile.user.email], fail_silently=True) + elif call_on == 'proposal_form': + message = dedent("""\ + Hey {0}, + + Please find the attachment, fill the form and reply to this + mail. + + In case of queries, please revert to this + email.""".format(contributor.profile.user.username)) + + logging.info("Animation Proposal Form 2: %s", request.user.email) + subject = "FOSSEE Animation Proposal Form 2" + msg = EmailMultiAlternatives(subject, message, SENDER_EMAIL, + [contributor.profile.user.email]) + attachment_paths = path.join(settings.MEDIA_ROOT, "Proposal_Form") + files = listdir(attachment_paths) + for f in files: + attachment = open(path.join(attachment_paths, f), 'rb') + part = MIMEBase('application', 'octet-stream') + part.set_payload((attachment).read()) + encoders.encode_base64(part) + part.add_header('Content-Disposition', "attachment; filename= %s " % f) + msg.attach(part) + msg.send() |