I need to send a few mails with my laravel application, and they are not really personalized. I’ve used the markdown mail system in laravel, and everything was smooth for the tests. I had mailtrap setup to catch all the mails, no problems.
Now I have to use mailjet to send mails – not to create emails and everything, just to have an adress to send them and a way to know where they did go. I’ve installed the laravel-mailjet package, I’ve done everything in the doc (except the last part, my mails already work), but no luck, nothing works. I don’t have any error in the logs, I don’t have any error when the mail is supposed to be thrown, it just kinda don’t try to send the mail at all. I’ve tried on local and prod (I was thinking that maybe it was because of the dns), everything is perfectly setup between my dns and mailjet, but I can’t launch any mail and google is no help on this one.
.env
MAIL_MAILER=mailjet MAIL_HOST=in-v3.mailjet.com MAIL_PORT=587 MAIL_USERNAME={api key} MAIL_PASSWORD={api secret} MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS={mail} MAIL_FROM_NAME="${APP_NAME}" MAILJET_APIKEY={api key} MAILJET_APISECRET={api secret}
app.php
'providers' => [ ... MailjetLaravelMailjetMailjetServiceProvider::class, MailjetLaravelMailjetMailjetMailServiceProvider::class, ], 'aliases' => [ ... 'Mailjet' => MailjetLaravelMailjetFacadesMailjet::class, ],
mail.php
'mailers' => [ .... 'mailjet' => [ 'transport' => 'mailjet', ], ],
services.php
'mailjet' => [ 'key' => env('MAILJET_APIKEY'), 'secret' => env('MAILJET_APISECRET'), 'transactional' => [ 'call' => true, 'options' => [ 'url' => 'api.mailjet.com', 'version' => 'v3.1', 'call' => true, 'secured' => true ] ], 'common' => [ 'call' => true, 'options' => [ 'url' => 'api.mailjet.com', 'version' => 'v3', 'call' => true, 'secured' => true ] ], 'v4' => [ 'call' => true, 'options' => [ 'url' => 'api.mailjet.com', 'version' => 'v4', 'call' => true, 'secured' => true ] ], ]
I’ve tried to erase all my modifications and just let the .env, with no luck too. What am I missing?
Advertisement
Answer
Ok, found my problem. The whole setup was good, it was in the Mailable class that I was missing something; the mail used to send the confirmation wasn’t register in Mailjet. Just a modification in the ->from(email)
in the class and everything works now.
It’s just weird that I couldn’t get any error message that could give me clue on what was going on, no error in logs and no error on Mailjet.