mailjet / laravel-mailjet

Laravel package for Mailjet API V3 and Laravel Mailjet Mail Transport
MIT License
94 stars 93 forks source link

Mail sent but no message is actually sent #81

Closed yanickrochon closed 1 month ago

yanickrochon commented 1 month ago

After following the README.md file for Laravel 10.x, including setting the .env variables, like

MAIL_MAILER=mailjet
MAIL_DEBUG=true
MAILJET_APIKEY={redacted:api_key}
MAILJET_APISECRET={redacted:api_secret}
MAIL_FROM_ADDRESS=no-reply@{redacted:domain}
MAIL_FROM_NAME=Admin

I ran php artisan tinker and tried this like:

$msg = Mail::raw('Message Test!', function($msg) {$msg->to('{redacted:my_work_email}')->subject('Test Mailer'); });

It returns an object of type Illuminate\Mail\SentMessage. Inspecting the debug information from the message, I get:

* Host api.mailjet.com:443 was resolved.
* IPv6: (none)
* IPv4: 35.187.79.8
*   Trying 35.187.79.8:443...
* Connected to api.mailjet.com (35.187.79.8) port 443
* ALPN: curl offers h2,http/1.1
*  CAfile: C:\php\cacert.pem
*  CApath: none
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 / RSASSA-PSS
* ALPN: server accepted h2
* Server certificate:
*  subject: C=FR; L=Paris; O=MAILJET SAS; CN=mailjet.com
*  start date: Mar 12 00:00:00 2024 GMT
*  expire date: Apr  2 23:59:59 2025 GMT
*  subjectAltName: host "api.mailjet.com" matched cert's "*.mailjet.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1
*  SSL certificate verify ok.
*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 1: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://api.mailjet.com/v3.1/send
* [HTTP/2] [1] [:method: POST]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: api.mailjet.com]
* [HTTP/2] [1] [:path: /v3.1/send]
* [HTTP/2] [1] [accept: application/json]
* [HTTP/2] [1] [content-type: application/json]
* [HTTP/2] [1] [authorization: Basic {redacted:bearer_token}]
* [HTTP/2] [1] [user-agent: Symfony HttpClient (Curl)]
* [HTTP/2] [1] [accept-encoding: gzip]
* [HTTP/2] [1] [content-length: 310]
> POST /v3.1/send HTTP/2
Host: api.mailjet.com
Accept: application/json
Content-Type: application/json
Authorization: Basic {redacted:bearer_token}
User-Agent: Symfony HttpClient (Curl)
Accept-Encoding: gzip
Content-Length: 310

* upload completely sent off: 310 bytes
* old SSL session ID is stale, removing
< HTTP/2 200

All sems to be good, however no message is sent.

yanickrochon commented 1 month ago

Update: the domain must be validated before emails can be sent.