lara28580's avatar

Again Mailgun always gives me "550 5.7.1 Relaying denied "

I am a little bit desperate no matter what I try mailgun always gives me "550 5.7.1 Relaying denied". I pretty sure I set everything up properly but I cant use Mail::to(). My domain is verified on mailgun my .env variables are set like so

MAIL_DRIVER=mailgun
MAILGUN_DOMAIN=mg.domain.com
MAILGUN_SECRET=api-key
MAILGUN_ENDPOINT=https://api.eu.mailgun.net/v3/mg.domain.com

Still it does not work. I am on a plan also but does not change anything. I really dont know what to do anymore.

0 likes
10 replies
lara28580's avatar

Thanks for the answer but I dont get it. So it is necessary to use the smtp credentials even if I use the api? Or do I understand that wrong?

lara28580's avatar

Error persists even if I setup a route with catch all. How hard could it be to setup a email ;(

Snapey's avatar

Relaying denied means you are trying to send email with an invalid FROM address (one not authorised by Mailgun)

1 like
mvdnbrk's avatar

Change this:

MAILGUN_ENDPOINT=api.eu.mailgun.net

Also make sure your domain is verified with mailgun.

1 like
Snapey's avatar
Snapey
Best Answer
Level 122

open tinker and run config('mail') and check all values are as expected

2 likes
lara28580's avatar

Guys thank you so much it works now :)))!! Both answers helped me had to change the endpoint and the .env variable MAIL_DRIVER to MAIL_MAILER

1 like
Gompje's avatar

Thank you! Was pulling my hair why my production wouldn't send mails anymore -timing couldn't be worse. Forgot to document that the ENV value was changed. :doh!:

ZermattChris's avatar

After hours of trying to figure out why I'm getting a "relay denied" error when trying to send mail via Laravel (I can send directly from the Terminal with via mail [Ubuntu server]), I found this gem -- thanks! I'm seeing that Laravel is trying vainly to send to "smtp.mailgun.org" and not my mail server... Wish me luck! :)

Please or to participate in this conversation.