user860511
user860511

Reputation:

Laravel - 404 Not found error when sending an email to Mailgun

I have added the two TXT records to enable the sending of SMTP emails, and my account is now active.

My mail.php:

<?php

return [
    'driver' => 'mailgun',
    'host' => 'smtp.mailgun.org',
    'port' => '587',
    'from' => ['address' => 'nathan@*****', 'name' => 'Nathan ******'],
    'encryption' => 'tls',
    'username' => 'postmaster@auditing.*********.com',
    'password' => '*************************',
    'sendmail' => '/usr/sbin/sendmail -bs',
];

and services.php is:

'mailgun' => [
    'domain' => 'https://api.mailgun.net/v3/auditing.***********.com',
    'secret' => '**************************',
],

The error that I'm getting is:

Client error: `POST https://api.mailgun.net/v3/https://api.mailgun.net/v3/auditing.***********.com/messages.mime` resulted in a `404 NOT FOUND` response:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested (truncated...)

I originally had these in my .env file, but I put them directly into mail.php just to verify if it was a typo etc... It fails in both scenarios.

Am I missing anything? Looking at the 404 error, the domain it's trying to post to looks incorrect:

https://api.mailgun.net/v3/https://api.mailgun.net/v3/auditing.***********.com/messages.mime

Why is the https://api.mailgun.net/v3/ at the start?

Any help would be hugely appreciated.

Upvotes: 3

Views: 3608

Answers (1)

odannyc
odannyc

Reputation: 718

Your domain should only contain your personal domain provided by Mailgun, so try this:

'mailgun' => [
    'domain' => 'auditing.***********.com',
    'secret' => '**************************',
],

Upvotes: 6

Related Questions