Je reçois une erreur ci-dessous:
La connexion n'a pas pu être établie avec l'hôte smtp.gmail.com [php_network_getaddresses: getaddrinfo a échoué: aucun de ces hôtes n'est connu.
0]
Mon fichier .env ressemble à:
MAIL_Host=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxxxxxxxxxx
MAIL_PASSWORD=xxxxxxxx
#MAIL_ENCRYPTION=null
Mon fichier mail.php dans config ressemble à ceci:
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill",
| "ses", "sparkpost", "log"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the Host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'Host' => env('MAIL_Host', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the Host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => ['address' => null, 'name' => null],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
];
Étonnamment, je l'utilise depuis 6 mois et elle ne s'est pas trompée plus tôt, mais maintenant, lorsque j'ai téléchargé à nouveau ma version construite, cette erreur s'est produite.
Toutes les suggestions seraient très appréciées.
Je viens d'avoir ce même problème.
Il semble que le serveur ne soit pas en mesure d'envoyer une requête ping à l'adresse de destination.
J'ai redémarré rapidement mon serveur dev et tout est revenu à la normale.
J'espère que cela pourra aider.
Ce problème se produit lorsque des modifications ont été apportées aux fichiers, notamment dans le fichier .env.
Effacer le cache en utilisant la commande artisan
php artisan cache:clear
Effacer la configuration
php artisan config:clear
Redémarrez votre serveur
Sudo service Apache2 restart
Plus: Essayez d'effacer le cache des navigateurs et les cookies. J'espère que ça marche
Après avoir modifié vos paramètres, vous devez exécuter: Php artisan config: cache
Sans ces laravel utilisera les anciens.
Utilisez MAIL_ENCRYPTION = TLS
Essayez de vider le cache, de configurer le cache et de redémarrer Apache2. Ça marche.
Le problème est en réalité une simple faute de frappe. Dans votre fichier .env, changez ceci:
MAIL_DRIVER=smtp
MAIL_Host=mailtrap.io
pour ça:
MAIL_DRIVER=smtp
MAIL_Host=smtp.mailtrap.io
J'ai ajouté le smtp.
à l'hôte
'driver' => env('MAIL_DRIVER', 'smtp'),
'Host' => env('MAIL_Host', 'your mail Host'),
'port' => env('MAIL_PORT', '465'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'Your email address'),
'name' => env('MAIL_FROM_NAME', 'Your email Name'),
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
MAIL_DRIVER=smtp
MAIL_Host=your mail Host
MAIL_PORT=465
MAIL_USERNAME=Your smtp email address
MAIL_PASSWORD=Your smtp password
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=Your email address
MAIL_FROM_NAME="Your email Name"
php artisan config: effacer
php artisan cache: effacer
Sudo service httpd restart
Ce sera des travaux! Profitez de votre codage