skip to Main Content

when I try to send an email with mailgun in laravel (i send by API not smtp) it gives me this error:

Could not reach the remote Mailgun server.

2

Answers


  1. This is a blog example to setup a mailing list, but maybe it could give you an idea of how to send an email.
    https://fperdomo.dev/blog/how-to-set-up-a-mailing-list-with-laravel-statamic-and-mailgun
    The setup is the same. The only difference is that I used this to send the email:

    Mail::send('mail.contact', [
                'name' => $request->get('name'),
                'email' => $request->get('email'),
                'text' => $request->get('message'),
            ], function ($message) {
                $message->to($this->sendTo, 'Contact from Profile')
                        ->subject($this->subject);
                $message->from($this->from, 'Fermin web site');
            });
    
    Login or Signup to reply.
  2. You mentioned in a comment that you added your IP to the whitelist but did you add the server’s IP?

    Your IP and your server’s IP might not be the same.

    Also, did you try to send this email via a simple command line (bash curl or equivalent)?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search