Distribution de travail : Ubuntu 20.04
Liens : https://kinsta.com/fr/blog/mailhog/ https://www.lullabot.com/articles/installing-mailhog-for-ubuntu-1604
samuelg@optiplex:~$ sudo apt-get -y install golang-go
samuelg@optiplex:~$ mkdir MAILHOG
samuelg@optiplex:~$ cd MAILHOG/
samuelg@optiplex:~/MAILHOG$
samuelg@optiplex:~/MAILHOG$ go get github.com/mailhog/MailHog samuelg@optiplex:~/MAILHOG$ go get github.com/mailhog/mhsendmail
samuelg@optiplex:~/MAILHOG$ ls -l ~/go/bin/
total 18784
-rwxrwxr-x 1 samuelg samuelg 13514285 sep 8 09:54 MailHog
-rwxrwxr-x 1 samuelg samuelg 5717844 sep 8 09:52 mhsendmail
samuelg@optiplex:~/MAILHOG$ sudo cp ~/go/bin/MailHog /usr/local/bin/mailhog
samuelg@optiplex:~/MAILHOG$ sudo cp ~/go/bin/mhsendmail /usr/local/bin/
samuelg@optiplex:~/MAILHOG$ mailhog \
-api-bind-addr 127.0.0.1:8025 \
-ui-bind-addr 127.0.0.1:8025 \
-smtp-bind-addr 127.0.0.1:1025
Adresse SMTP local : localhost Port SMTP local : 1025
http://localhost:8025/
Ouvrir :
/etc/php/7.4/apache2/php.ini
Chercher :
;sendmail_path =
Remplacer par :
sendmail_path = /usr/local/bin/mhsendmail
Ouvrir :
/etc/php/7.4/cli/php.ini
Chercher :
;sendmail_path =
Remplacer par :
sendmail_path = /usr/local/bin/mhsendmail
$ mhsendmail test@mailhog.local <<EOF
From: Samuel <contact@monsite.local>
To: Test <test@mailhoga.local>
Subject: Hello, MailHog!
Bonjour à tous !
Sam
EOF
Créer :
sendMail.php
Ajouter :
<?php
$to = "test@mailhog.local";
$subject = "Hey, I’m Pi Hog Pi!";
$body = "Hello, MailHog!";
$headers = "From: pihogpi@kinsta.com" . "\r\n";
mail($to,$subject,$body,$headers);
?>
$ php ./sendMail.php
https://wordpress.org/plugins/wp-mail-smtp/
Configuration :
Test :
[Envoyer l'email]