question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MailgunAPIError: <Response [400]>

See original GitHub issue

Hi,

I just following your readme, but I keep getting this error :

Image of Yaktocat

This is my setting (I’m not sure, whether I should using secret key or public key, but both is error when I’m trying to send email) :

EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = 'key-06b1d48a5805393c825ceefa054bXXXX'
MAILGUN_SERVER_NAME = 'sandboxfa1f6fe021044f319c639f9da08eXXXX.mailgun.org'

My views.py :

def order_form(request):
    if request.method == "POST":
        form = OrderForm(request.POST, request.FILES)
        if form.is_valid():
            order = form.save(commit=False)
            order.tanggal_order = datetime.datetime.now()
            order.save()
            subject = "NEW ZEGUYO ORDER"
            to = [order.email, 'alzea.arafat@gmail.com', 'cahyosumirat93@gmail.com']
            from_email = 'no-reply@zeguyo.com'
            ctx = {
                'nama': order.nama,
                'id_order': order.id,
            }
            message = get_template('email/order_email.html').render(Context(ctx))
            msg = EmailMessage(subject, message, to=to, from_email=from_email)
            msg.content_subtype = 'html'
            msg.send()
            return render(request, 'order_app/order_success.html')
    else:
        form = OrderForm()
    return render(request, 'order_app/order_form.html', {'form': form})

I’m using django 1.9.2, Python 2.7

Did I miss something here?

Thank you in advance for any help you can provide 😃

Regards,

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

2reactions
ithincocommented, May 7, 2016

Got the same error

@alzearafat try below settings in mailgun

Security Settings For Outgoing Mail Certificate Verification Not Required

it works for me

2reactions
ozren1983commented, Apr 12, 2016

You can see error details in your Mailgun Logs. I got 400 response because I haven’t activated account.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MailgunAPIError<Response [400]> with ... - Stack Overflow
I'm trying to send registration emails by django-registration-redux, but got this response code: MailgunAPIError Response [400].
Read more >
Introduction — Mailgun API documentation
Mailgun returns standard HTTP response codes. Code, Description. 200, Everything worked as expected. 400, Bad Request - Often missing ...
Read more >
MailgunAPIError<Response [400]> with django-registration ...
I solved the problem by myself. I changed the EMAIL_BACKEND from 'django_mailgun.MailgunBackend' to 'django.core.mail.backends.smtp.
Read more >
Bountysource
MailgunAPIError : <Response [400] · Javascript Required. Kindly enable Javascript. · Updates · Content Removed.
Read more >
django_mailgun.MailgunAPIError: Response [401] - CSDN博客
完整报错如下:Internal Server Error: /accounts/login/Traceback (most ... 使用HTTP Status区分不同消息返回最基础的三个状态200 OK, 400 Client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found