Repository: dotkom/onlineweb4

Issue:
Posters issues
- [ ] Does not send mail [src](https://github.com/dotKom/onlineweb4/blob/f4c45b9d07bd2c20533dec840a3bdcb3b8d50dd3/apps/posters/dashboard/views.py#L106)
- [x] Group is set to "Komiteer" [src](https://github.com/dotKom/onlineweb4/blob/f4c45b9d07bd2c20533dec840a3bdcb3b8d50dd3/apps/posters/dashboard/views.py#L93)



Discussion:
Okay so I have no idea why it won't send an email.
In my dev environment, the email is printed out in the console, because we locally use console email backend (prints email to console) [src](https://github.com/dotKom/onlineweb4/blob/develop/onlineweb4/settings/example-local.py#L55)

I copied the code from "Email participants to an event" [src](https://github.com/dotKom/onlineweb4/blob/develop/apps/events/views.py#L304), and swapped out some stuff to make it fit posters. [result](https://github.com/dotKom/onlineweb4/blob/develop/apps/posters/dashboard/views.py#L105)

Why does it not send an email? Can someone who has set up email sending before take a look at it and tell me why it doesn't work?

@Torrib @hernil @melwil (when you're back home :D)

You have to add .send() on the EmailMessage (line 138)

:p

It calls .send() On line 136. Not sure where you have L138 from?
`email_sent = EmailMessage(unicode(subject), unicode(message), from_email, to_emails, []).send()`


Resolving patch:
diff --git a/apps/posters/dashboard/views.py b/apps/posters/dashboard/views.py
--- a/apps/posters/dashboard/views.py
+++ b/apps/posters/dashboard/views.py
@@ -106,14 +106,14 @@ def add(request, order_type=0):
             subject = '[ProKom] Ny bestilling for %s' % title
             email_message = '%(message)s%(signature)s' % {
                     'message': _('''
-                    Det har blitt registrert en ny %(order_type)sbestilling pa Online sine nettsider. Dette er bestilling nummer %(id)s.
-                    \n
-                    Antall og type: %(num)s * %(order_type)s\n
-                    Arrangement: %(event_name)s\n
-                    Bestilt av: %(ordered_by)s i %(ordered_by_committee)s\n
-                    Bestilt dato: %(ordered_date)s\n
-                    \n
-                    For mer informasjon, sjekk ut bestillingen her: %(absolute_url)s
+Det har blitt registrert en ny %(order_type)sbestilling pa Online sine nettsider. Dette er bestilling nummer %(id)s.
+\n
+Antall og type: %(num)s * %(order_type)s\n
+Arrangement: %(event_name)s\n
+Bestilt av: %(ordered_by)s i %(ordered_by_committee)s\n
+Bestilt dato: %(ordered_date)s\n
+\n
+For mer informasjon, sjekk ut bestillingen her: %(absolute_url)s
                     '''
                     % {
                         'site': '',
@@ -130,13 +130,9 @@ def add(request, order_type=0):
                     'signature': _('\n\nVennlig hilsen Linjeforeningen Online')
             }
             from_email = settings.EMAIL_PROKOM
-            to_emails = [settings.EMAIL_PROKOM, request.user.get_email()]
-
-            try:
-                email_sent = EmailMessage(unicode(subject), unicode(message), from_email, to_emails, []).send()
-            except:
-                email_sent = False
+            to_emails = [settings.EMAIL_PROKOM, request.user.get_email().email]
 
+            email_sent = EmailMessage(unicode(subject), unicode(email_message), from_email, to_emails, []).send()
             if email_sent:
                 messages.success(request, 'Opprettet bestilling')
             else:


Test patch: