@@ -131,7 +131,11 @@ def create_proposal(request, conference_slug):
131131 proposal_type_id = form .cleaned_data ['proposal_type' ],
132132 proposal_section_id = form .cleaned_data ['proposal_section' ])
133133 host = '{}://{}' .format (settings .SITE_PROTOCOL , request .META .get ('HTTP_HOST' ))
134- send_mail_for_new_proposal .delay (proposal .id , host )
134+
135+ if settings .USE_ASYNC_FOR_EMAIL :
136+ send_mail_for_new_proposal .delay (proposal .id , host )
137+ else :
138+ send_mail_for_new_proposal (proposal .id , host )
135139
136140 return HttpResponseRedirect (reverse ('proposal-detail' ,
137141 args = [conference .slug , proposal .slug ]))
@@ -387,9 +391,16 @@ def proposal_upload_content(request, conference_slug, slug):
387391 raise PermissionDenied
388392
389393 host = '{}://{}' .format (settings .SITE_PROTOCOL , request .META ['HTTP_HOST' ])
390- send_mail_for_proposal_content .delay (conference .id , proposal .id , host )
391394
392- message = 'Email sent successfully.'
395+ if settings .USE_ASYNC_FOR_EMAIL :
396+ send_mail_for_proposal_content .delay (conference .id , proposal .id , host )
397+ message = 'Email sent successfully.'
398+ else :
399+ response = send_mail_for_proposal_content (conference .id , proposal .id , host )
400+ if response == 1 :
401+ message = 'Email sent successfully.'
402+ else :
403+ message = 'There is problem in sending mail. Please contact conference chair.'
393404
394405 return HttpResponse (message )
395406
0 commit comments