Skip to content
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

πŸ’Œβ“ modernomad.core.views.unsorted.BookingSendMail is not checking the return code from MailGun #848

Open
omoustaouda opened this issue Sep 6, 2021 · 0 comments

Comments

@omoustaouda
Copy link

omoustaouda commented Sep 6, 2021

modernomad.core.views.unsorted.BookingSendMail is not checking the return code from MailGun

When sending an email from the edit booking view,
Your message was sent is always shown, regardless of the returned status from Mailgun.

The Mailgun sending function (modernomad.core.emails.mailgun.mailgun_send) is actually providing the return code, it's just not being checked, causing the user to think that important emails has been sent, while they might not have been sent (due to misconfigurations, wrong host, IP whitelisting, etc.)

def BookingSendMail(request, location_slug, booking_id):
    if not request.method == 'POST':
        return HttpResponseRedirect('/404')

    _assemble_and_send_email(location_slug, request.POST)
    booking = Booking.objects.get(id=booking_id)
    booking.mark_last_msg()
    messages.add_message(request, messages.INFO, "Your message was sent.") # <---- this message is always shown, also on error, when emails can't be delivered
    return HttpResponseRedirect(reverse('booking_manage', args=(location_slug, booking_id)))```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant