{"id":931,"date":"2022-12-24T04:46:13","date_gmt":"2022-12-24T03:46:13","guid":{"rendered":"https:\/\/sascha-brockel.de\/?p=931"},"modified":"2024-01-20T03:23:19","modified_gmt":"2024-01-20T02:23:19","slug":"send-mails-from-wordpress-docker-container","status":"publish","type":"post","link":"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/","title":{"rendered":"Send mails from WordPress (PHP) Docker container"},"content":{"rendered":"<p class=\"yoast-reading-time__wrapper\"><span class=\"yoast-reading-time__icon\"><svg aria-hidden=\"true\" focusable=\"false\" data-icon=\"clock\" width=\"20\" height=\"20\" fill=\"none\" stroke=\"currentColor\" style=\"display:inline-block;vertical-align:-0.1em\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 24 24\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z\"><\/path><\/svg><\/span><span class=\"yoast-reading-time__spacer\" style=\"display:inline-block;width:1em\"><\/span><span class=\"yoast-reading-time__descriptive-text\">Expected Reading Time:  <\/span><span class=\"yoast-reading-time__reading-time\">13<\/span><span class=\"yoast-reading-time__time-unit\"> minutes<\/span><\/p>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-group-3dd4f78e\" class=\"wp-block-themeisle-blocks-button-group wp-block-buttons\">\n<div id=\"wp-block-themeisle-blocks-button-0216265f\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#recovery-mode\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-hammer margin-right\"><\/i><span>Recovery Mode <\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-16e5d69f\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#dockerfile\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fab fa-fw fa-docker margin-right\"><\/i><span>Dockerfile<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-eb189012\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#postfix-values\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-book-reader margin-right\"><\/i><span>Read values<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-f05d3cc1\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#docker-netzwerk\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-network-wired margin-right\"><\/i><span>Docker network<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-629735b4\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#postfix\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-mail-bulk margin-right\"><\/i><span>Postfix<\/span><\/a><\/div>\n<\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-group-1e4ef98a\" class=\"wp-block-themeisle-blocks-button-group wp-block-buttons\">\n<div id=\"wp-block-themeisle-blocks-button-7837713e\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#php\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fab fa-fw fa-php margin-right\"><\/i><span>php.ini<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-956e45b6\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#docker-compose\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-file margin-right\"><\/i><span>Docker Compose<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-1b377f0c\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#docker-image\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-terminal margin-right\"><\/i><span>Docker Image<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-64faa78a\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#testing\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-microscope margin-right\"><\/i><span>Testing<\/span><\/a><\/div>\n\n\n\n<div id=\"wp-block-themeisle-blocks-button-4499fbd0\" class=\"wp-block-themeisle-blocks-button wp-block-button\"><a href=\"#fazit\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-layer-group margin-right\"><\/i><span>Conclusion<\/span><\/a><\/div>\n<\/div>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer jp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Some time ago my WordPress website crashed fatally after a failed plugin update. The really fatal thing was that I didn't notice it at all. For more than a day, when calling my website, only an error was displayed. But why didn't I get any information about it? Unfortunately, this is due to the Docker image of WordPress, which by default does not allow to send emails.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Recovery_Mode_funktioniert_in_Docker_nicht_Out-of-the-box\" >Recovery Mode does not work out-of-the-box in Docker<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Wie_kann_man_E-Mails_aus_dem_Docker_Container_verschicken\" >How to send emails from Docker container?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Dockerfile_erstellen\" >Create Dockerfile<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Werte_fur_Postfix_auslesen\" >Read values for Postfix<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Docker_Netzwerk_Container_freigeben\" >Share Docker network \/ containers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Werte_in_Postfix_ubertragen\" >Transfer values to Postfix<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#SMTP_in_phpini_konfigurieren\" >Configure SMTP in php.ini<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Docker_Compose_anpassen\" >Docker Compose customize<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Build_des_eigenen_WordPress_Docker_Image\" >Build your own WordPress Docker image<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#WordPress_Recovery_Mode_testen\" >Test WordPress Recovery Mode<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/#Fazit\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"recovery-mode\"><span class=\"ez-toc-section\" id=\"Recovery_Mode_funktioniert_in_Docker_nicht_Out-of-the-box\"><\/span>Recovery Mode does not work out-of-the-box in Docker<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Actually, there is the built-in recovery mode of WordPress, which sends an email to you if something is wrong. But if you are running WordPress with the default Docker image, this does not work out of the box. But you can fix the whole thing with some configurations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I already have several check methods on my services like a Healthy Check on the Docker Containers and also through Uptime Kuma a regular test if the URL is still reachable. Both had not grumbled because the website was still reachable via the URL. But only as a small window with an error code. Since the status code of the web page remains 20x, so for example 200 for OK, the whole thing remained undetected and finally gave me to think.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the logs of the WordPress container I then discovered the logging of the errors and very importantly an entry:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sh: 1: \/usr\/sbin\/sendmail<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It quickly became clear that an attempt was made to send an email to me, but the necessary package including configuration for this is not installed in the Docker image. Until this point, I always thought it would be enough to have a plugin like WP Mail SMTP installed or generally work, that you receive emails from the WordPress instance. In retrospect, this makes little sense, since it could also be a plugin that is faulty and WordPress itself also never received a mail configuration from me.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the recovery mode would work, instead of no information at all, you would get an email with hints about the error as you can see in the image below. Unfortunately, probably far too few operators and users know that the Recovery Mode function of WordPress in Docker does not work without effort.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full ticss-f48fb9db\"><a href=\"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"750\" height=\"384\" src=\"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?resize=750%2C384&#038;ssl=1\" alt=\"WordPress Recovery Mode email with information\" class=\"wp-image-947\" srcset=\"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?w=1587&amp;ssl=1 1587w, https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?resize=300%2C153&amp;ssl=1 300w, https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?resize=768%2C393&amp;ssl=1 768w, https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?resize=1536%2C786&amp;ssl=1 1536w, https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Recovery-Mode.jpg?resize=18%2C9&amp;ssl=1 18w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong>WordPress Recovery Mode email with information<\/strong> <strong>about an error<\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Recovery Mode is enabled out of the box, but by default this email cannot be sent due to the missing <code>sendmail<\/code> Do not send package. You miss important information about problems with the website. I have hidden personal information on the image.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-wie-kann-man-e-mails-aus-dem-docker-container-verschicken\"><span class=\"ez-toc-section\" id=\"Wie_kann_man_E-Mails_aus_dem_Docker_Container_verschicken\"><\/span>How to send emails from Docker container?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The clue for me after the error was of course the package <code>sendmail<\/code>which was not easy to install or use at all. The problem seems to be a general problem with PHP applications, if they are also available as Docker image. There are probably some solutions where you provide another Docker container with another image only for mails. This can make sense if you have multiple PHP applications and don't want to customize the image everywhere. For me it was not a satisfying solution to provide another container that takes up memory again and runs permanently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"dockerfile\"><span class=\"ez-toc-section\" id=\"Dockerfile_erstellen\"><\/span>Create Dockerfile<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Accordingly, the first step of the solution is that we need to craft our own Dockerfile for WordPress. However, unlike expected, we do not add <code>sendmail<\/code> but bypass s package. The Dockerfile should then look like this:<\/p>\n\n\n\n<pre id=\"dockerfile\" class=\"wp-block-code\"><code>FROM wordpress:latest\n\nRUN \\\n    apt-get update &amp;&amp; \\\n    apt-get install -y --no-install-recommends \\\n    libicu-dev \\\n    libldap2-dev \\\n    ssmtp &amp;&amp; \\\n    docker-php-ext-install intl &amp;&amp; \\\n    docker-php-ext-enable intl &amp;&amp; \\\n    docker-php-ext-install shmop &amp;&amp; \\\n    docker-php-ext-enable shmop\n\n# modify ssmtp settings\nRUN sed -ri -e 's\/^(mailhub=).*\/\\1smtp-server\/' \\\n    -e 's\/^#(FromLineOverride)\/\\1\/' \/etc\/ssmtp\/ssmtp.conf\n\nRUN \\\n    pecl install apcu &amp;&amp; \\\n    docker-php-ext-enable apcu<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That's a bit much at once and also some code you probably don't need. But it can not hurt in any case. We use the latest image of WordPress as a base and then first download the information about the latest packages, and then we load them without any prompts that we could not answer during the build with <code>apt-get install -y --no-install-recommends<\/code> to install. The backslash <code>\\<\/code> at the end of a line is mainly for readability. So you can break the line without breaking the command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the mail functionality only the installation of the <code>ssmtp<\/code> package and the command <code>RUN sed -ri -e 's\/^(mailhub=).*\/\\1smtp-server\/' \\ -e 's\/^#(FromLineOverride)\/\\1\/' \/etc\/ssmtp\/ssmtp.conf<\/code> necessary. The rest of the installed packages are used to install OPcache and APCu. These two help with the performance of the website. OPcache is a PHP module that caches the PHP code of the web application (for example, scripts) in memory. APCu does basically the same thing, but is responsible for a different part of data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Back on topic, we now need to create the image using the Dockerfile as well. You simply store the content in a file named <code>Dockerfile<\/code>. Do not add a file extension. Ideally, you should then save this file on your server where you also saved your <strong>docker-compose.yml<\/strong> for WordPress.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"postfix-values\"><span class=\"ez-toc-section\" id=\"Werte_fur_Postfix_auslesen\"><\/span>Read values for Postfix<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is elementary that you have to install the package <code>postfix<\/code> and configured it so that you can send e-mails with it. Among other things, you need this anyway for unattended upgrades to be informed about automatic updates on your server. For the following part it is assumed that you have installed postfix and configured it to send emails.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even though we now have the necessary package installed through the Dockerfile that makes sending the emails possible, there are still issues that make it not possible to do this from Docker. If you would do this now, you would see the error <code>554 5.7.1 Relay access denied<\/code> received. This is because Docker, and in particular here the WordPress Docker container, are not authorized to send emails via Postfix. Accordingly, we need to adjust the configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have two options for the configuration of <code>inet_interfaces<\/code>. We can set the value to <code>all<\/code> and thus accept all incoming connections or we have to specify which network interfaces should be accepted. With <code>ip link show<\/code> you can display all interfaces:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1\n    link\/loopback 00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00\n2: eth0:  mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000\n    link\/ether 00:1e:06:42:24:a3 brd ff:ff:ff:ff:ff:ff:ff:ff\n3: docker0:  mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default\n    link\/ether 02:42:d2:7c:62:3c brd ff:ff:ff:ff:ff:ff:ff:ff<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now it is important that we find out which IP address is behind the respective network interfaces. We can do this with the command <code>ifconfig<\/code> so for example <code>ifconfig docker0<\/code> to find out. The output then looks like this;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker0: flags=4099 mtu 1500\n        inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255\n        inet6 fe80::42:d2ff:fe7c:623c prefixlen 64 scopeid 0x20\n        ether 02:42:d2:7c:62:3c txqueuelen 0 (Ethernet)\n        RX packets 2710 bytes 159432 (159.4 KB)\n        RX errors 0 dropped 0 overruns 0 frame 0\n        TX packets 3090 bytes 39984102 (39.9 MB)\n        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the value that is used for <code>inet<\/code> is relevant. This may be different for you. Use the value that your system outputs. With the lo (loopback\/localhost) adapter the IP address will always be <strong>127.0.0.1<\/strong> but check that too. For all adapters that you want to allow, remember the IP address or store it somewhere between.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"docker-netzwerk\"><span class=\"ez-toc-section\" id=\"Docker_Netzwerk_Container_freigeben\"><\/span>Share Docker network \/ containers<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The more complicated part now follows. We also need to release the Docker container or its network. This can be very individual. For example, I use a separately defined network for my WordPress container in docker-compose.yml. Accordingly, the network address changes every time it is stopped and started. If you have not specified a network, you will usually find the container in a network with the name _default. The easiest way to view this is in Portainer. Otherwise, you will need to enter a few commands to find out (including <code>docker inspect<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Relevant for us is the IPV4 IPAM subnet address. For my network storage_wordpress it is 172.19.0.0\/16. Ideally, we now set this subnet address statically so that it no longer changes and our configuration is always valid and works. To do this, go to your docker-compose.yml file for WordPress. You now have to add the <code>services:<\/code> add another point.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>networks:\n  wordpress:\n    ipam:\n      config:\n        - subnet: 172.19.0.0\/16<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also do this if your network is in the WordPress container <strong>default <\/strong>is called. It is also important that you add the network to the container if you don't already have it. You should also do this for the associated database, so that the two can continue to communicate with each other.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  wordpress:\n    container_name: wordpress\n    networks:\n      - wordpress\n    ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We don't need to restart the Compose file yet, because we are not finished. We will do that at the very end.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"postfix\"><span class=\"ez-toc-section\" id=\"Werte_in_Postfix_ubertragen\"><\/span>Transfer values to Postfix<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We now edit the configuration in Postfix with the command <code>sudo nano \/etc\/postfix\/main.cf<\/code>. There you enter now at <code>inet_interfaces = all<\/code> or <code>inet_interfaces = ,<\/code> an. The values are separated by commas. We can now specify the Docker network at the point <code>mynetworks<\/code> enter. Leave existing values as they are and add a comma with your subsequent IPV4 IPAM subnet address. This looks like this for me:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mynetworks = 127.0.0.0\/8 [::ffff:127.0.0]\/104 [::1]\/128, 172.19.0.0\/16<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of the IP address of the network, you can also specify only a direct IP address of a container. This would work in the same way. But after restarting containers, the risk is very high that if the container has not also been assigned a static IP address, that the value changes and the configuration is unusable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We note that in the file <code>\/etc\/postfix\/main.cf<\/code> only the values of the lines <code>inet_interfaces<\/code> and <code>mynetworks<\/code> and we are done here. Finally we have to restart Postfix to apply the changes. We do this with the command <code>sudo systemctl restart postfix<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"php\"><span class=\"ez-toc-section\" id=\"SMTP_in_phpini_konfigurieren\"><\/span>Configure SMTP in php.ini<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">So that our <a href=\"#dockerfile\">Dockerfile<\/a> now really comes to bear, we still have to tell WordPress what it should use to send the emails. The command <code>RUN sed -ri -e 's\/^(mailhub=).*\/\\1smtp-server\/' \\ -e 's\/^#(FromLineOverride)\/\\1\/' \/etc\/ssmtp\/ssmtp.conf<\/code> lays <strong>smtp-server<\/strong> as the value by which the mailhub or Postfix can be reached.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you already have a php.ini file installed \/ set up on your WordPress server, then add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SMTP=smtp-server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you don't have the file yet, it's no problem. Create in your WordPress folder a <strong>php.ini<\/strong> and references it in docker-compose.yml:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    volumes:\n      - \/data\/website\/wordpress:\/var\/www\/html\n      - \/data\/website\/wordpress\/php.ini:\/usr\/local\/etc\/php\/conf.d\/php.ini<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here is only the line with <strong>php.ini<\/strong> relevant. The rest is the default of the WordPress installation. Now you also have an active php.ini for your WordPress installation. You also need it for OPCache settings or file upload settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"docker-compose\"><span class=\"ez-toc-section\" id=\"Docker_Compose_anpassen\"><\/span>Docker Compose customize<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We have told WordPress in the previous step that it should look at smtp-server for SMTP connections and also stored this value in php.ini, but we have not yet stored an IP address for this. This is where the IP address of the network interfaces docker0 comes into play again. As a reminder, you can get this address with the command <code>ifconfig docker0<\/code>  (<strong>inet<\/strong> value relevant). The complete docker-compose.yml (database not considered) looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: \"3\"\nnetworks:\n  wordpress:\n    ipam:\n      config:\n        - subnet: 172.19.0.0\/16\n\nservices:\n  wordpress-db:\n    container_name: wordpress-db\n    image: mariadb:latest\n    volumes:\n      - \/data\/site\/wordpress-db:\/var\/lib\/mysql\n    restart: always\n    networks:\n      - wordpress\n    env_file:\n      - .secrets\/wordpress.env\n    healthcheck:\n      test: mysql --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD -e 'SHOW DATABASES;'\n      interval: 20s\n      start_period: 10s\n      timeout: 10s\n      retries: 3\n\n  wordpress:\n    container_name: wordpress\n    links:\n      - wordpress-db\n    depends_on:\n      wordpress-db:\n        condition: service_healthy\n    image: saschabrockel\/wordpress:latest\n    build:\n      context: \/media\/storage\n      dockerfile: Dockerfile\n    expose:\n      - 80\n    restart: always\n    volumes:\n      - \/data\/website\/wordpress:\/var\/www\/html\n      - \/data\/website\/wordpress\/php.ini:\/usr\/local\/etc\/php\/conf.d\/php.ini\n    networks:\n      - wordpress\n    env_file:\n      - .secrets\/wordpress.env\n    extra_hosts:\n      - smtp-server:172.17.0.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The most important point is in the last line with <code>- smtp-server:172.17.0.1<\/code>. Here under <code>extra_hosts<\/code> defined as the IP address from the network adapter <strong>docker0<\/strong> to allow the connection. At the top we also find the network configuration. The <code>healthcheck<\/code> the database and also <code>depends_on<\/code> with the <code>service_healthy<\/code> You can disregard condition for yourselves. Now what is the last important point is the <code>build<\/code> Part:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    build:\n      context: \/media\/storage\n      dockerfile: Dockerfile<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You must enter there under <code>context<\/code> specify the exact path where your Dockerfile created at the beginning is located. And at <code>dockerfile<\/code> you enter the name of your Dockerfile. Finally you adjust the line <code>image<\/code> and enter a name of your choice for your own image.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"docker-image\"><span class=\"ez-toc-section\" id=\"Build_des_eigenen_WordPress_Docker_Image\"><\/span>Build your own WordPress Docker image<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Building the image with the Dockerfile now works relatively simple. We only need to add a little to our start command for the docker-compose.yml:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose -f \/media\/storage\/docker-compose.yml up -d --build<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note that you specify your own file path and file name. The -build parameter ensures that the image is created. The whole process takes a few moments. Now you are ready and have created your own email enabled Docker image.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"testing\"><span class=\"ez-toc-section\" id=\"WordPress_Recovery_Mode_testen\"><\/span>Test WordPress Recovery Mode<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can see whether you are really standing correctly when the light comes on. That also applies to this setup here. We need to validate that the whole thing worked. To do that, we'll ideally put in our own error and have it send us an email to our own email. By default, WordPress sends error emails like the one shown in the image above to the administrators. We can override the whole thing in that we can add in the <code>wp-config.php<\/code> in your WordPress installation the line <code>define( 'RECOVERY_MODE_EMAIL', 'deineMail@gmail.com' );<\/code> complete.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So far, so good, only the error is missing. First of all, I would like to point out that it was necessary for me to turn off plugins like Redis Object Cache, because otherwise the modified PHP code was not loaded, but only the cache was used.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To add a bug go to your WordPress installation under <code>wp-content\/themes\/yourTheme<\/code> into the <code>functions.php<\/code> and inserts the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function justtestingstuff() {\n\terror_log(\"Oh no! We are out of FOOs!\", 1, \"deineMail@gmail.com\");\n}\n\njusttestingstuff();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Have everything ready to undo the change directly and then go to the web page. You will very quickly receive a lot of emails with the defined error message. So now you can be sure that everything works. If you want to be completely safe, you can rename a file in a plugin and will probably trigger a real fatal error so quickly and make Recovery Mode send you an email. <strong>Under no circumstances should this be tried on an actively used website!<\/strong> Do not forget the <code>RECOVERY_MODE_EMAIL<\/code> to be reversed again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"fazit\"><span class=\"ez-toc-section\" id=\"Fazit\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">With this configuration you are well informed about errors in your WordPress instance on Docker. You will receive emails from the integrated WordPress Recovery Mode and thereby cleverly bypass the missing <code>sendmail<\/code> Package with the error visible in the logs <code>sh: 1: \/usr\/sbin\/sendmail<\/code>. Along the way, you have made all the arrangements to get through the <code>php.ini<\/code> to make individual adjustments and even created performance options through the Dockerfile.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In summary, you need to have Postfix set up, then create your own Dockerfile, make your WordPress Docker network static and deposit it in Postfix, create a <code>php.ini<\/code> and store SMTP there, your <strong>docker-compose.yml<\/strong> and you are done! Now you can send mails from your WordPress Docker container.<\/p>\n\n\n\n<div id=\"jp-block-themeisle-blocks-font-awesome-icons-8c6d8bc1\" class=\"wp-block-themeisle-blocks-font-awesome-icons jp-block-themeisle-blocks-font-awesome-icons\"><span class=\"wp-block-themeisle-blocks-font-awesome-icons-container\"><a href=\"https:\/\/sascha-brockel.de\/en\/#contact\" target=\"_self\" rel=\"noopener noreferrer\"><i class=\"fas fa-business-time\"><\/i><\/a><\/span><\/div>\n\n\n\n<h4 id=\"jp-block-themeisle-blocks-advanced-heading-baa7fa4c\" class=\"wp-block-themeisle-blocks-advanced-heading jp-block-themeisle-blocks-advanced-heading-baa7fa4c jp-block-themeisle-blocks-advanced-heading ticss-116fe371\">Interested, but lack time or knowledge?<\/h4>\n\n\n\n<p id=\"jp-block-themeisle-blocks-advanced-heading-16f35f43\" class=\"wp-block-themeisle-blocks-advanced-heading jp-block-themeisle-blocks-advanced-heading-16f35f43 jp-block-themeisle-blocks-advanced-heading ticss-0e2b851d\">No problem. Contact me and we will discuss your requirements. No matter if business or private.<\/p>\n\n\n\n<div id=\"jp-block-themeisle-blocks-button-group-77e0455a\" class=\"wp-block-themeisle-blocks-button-group wp-block-buttons align-center jp-block-themeisle-blocks-button-group jp-block-buttons\">\n<div id=\"jp-block-themeisle-blocks-button-c6fb3687\" class=\"wp-block-themeisle-blocks-button wp-block-button jp-block-themeisle-blocks-button jp-block-button\"><a href=\"https:\/\/sascha-brockel.de\/en\/#contact\" target=\"_self\" rel=\"noopener noreferrer\" class=\"wp-block-button__link\"><i class=\"fas fa-fw fa-phone-volume margin-right\"><\/i><span>Contact<\/span><\/a><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Vor einiger Zeit ist meine WordPress Webseite nach einem fehlgeschlagenen Plugin-Update fatal gecrasht. Das wirklich fatale daran war, dass ich es \u00fcberhaupt nicht mitbekommen habe. Mehr als einen Tag bekam man beim Aufruf meiner Webseite nur einen Fehler angezeigt. Aber warum habe ich keine Information dar\u00fcber erhalten? Das liegt leider [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":959,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[15,10,23],"tags":[16,33,37,22],"class_list":["post-931","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","category-tipps-tricks","category-wordpress","tag-docker","tag-e-mail","tag-postfix","tag-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.7 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Mails aus WordPress Docker Container senden - Sascha Brockel<\/title>\n<meta name=\"description\" content=\"E-Mails aus Docker Containern senden klappt bei WordPress nicht ohne Konfiguration. Fehlermeldungen per Mail erhalten leicht gemacht.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mails aus WordPress (PHP) Docker Container senden\" \/>\n<meta property=\"og:description\" content=\"E-Mails aus Docker Containern senden klappt bei WordPress nicht ohne Konfiguration. Fehlermeldungen per Mail erhalten leicht gemacht.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/\" \/>\n<meta property=\"og:site_name\" content=\"Sascha Brockel\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-24T03:46:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-20T02:23:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"3999\" \/>\n\t<meta property=\"og:image:height\" content=\"2666\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sascha Brockel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@saschabrockel\" \/>\n<meta name=\"twitter:site\" content=\"@saschabrockel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sascha Brockel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/\"},\"author\":{\"name\":\"Sascha Brockel\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#\\\/schema\\\/person\\\/3675ac2cf16fa04c60aca4dedca5c970\"},\"headline\":\"Mails aus WordPress (PHP) Docker Container senden\",\"datePublished\":\"2022-12-24T03:46:13+00:00\",\"dateModified\":\"2024-01-20T02:23:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/\"},\"wordCount\":2231,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#\\\/schema\\\/person\\\/3675ac2cf16fa04c60aca4dedca5c970\"},\"image\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1\",\"keywords\":[\"Docker\",\"E-Mail\",\"Postfix\",\"WordPress\"],\"articleSection\":[\"Docker\",\"Tipps &amp; Tricks\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#respond\"]}],\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/en\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/\",\"url\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/\",\"name\":\"Mails aus WordPress Docker Container senden - Sascha Brockel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1\",\"datePublished\":\"2022-12-24T03:46:13+00:00\",\"dateModified\":\"2024-01-20T02:23:19+00:00\",\"description\":\"E-Mails aus Docker Containern senden klappt bei WordPress nicht ohne Konfiguration. Fehlermeldungen per Mail erhalten leicht gemacht.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1\",\"width\":3999,\"height\":2666,\"caption\":\"WordPress-TitelbildWordPress-Titelbild\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/mails-aus-wordpress-docker-container-senden\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/sascha-brockel.de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mails aus WordPress (PHP) Docker Container senden\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#website\",\"url\":\"https:\\\/\\\/sascha-brockel.de\\\/\",\"name\":\"Sascha Brockel\",\"description\":\"Fortschritt kennt keine Grenzen\",\"publisher\":{\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#\\\/schema\\\/person\\\/3675ac2cf16fa04c60aca4dedca5c970\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sascha-brockel.de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/sascha-brockel.de\\\/#\\\/schema\\\/person\\\/3675ac2cf16fa04c60aca4dedca5c970\",\"name\":\"Sascha Brockel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1\",\"width\":709,\"height\":945,\"caption\":\"Sascha Brockel\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/sascha-brockel.de\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1\"},\"sameAs\":[\"https:\\\/\\\/sascha-brockel.de\\\/\",\"https:\\\/\\\/www.instagram.com\\\/saschabrockel\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sascha-brockel-b20725164\\\/\",\"https:\\\/\\\/x.com\\\/saschabrockel\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCogo25FboCahP7s8--HDuIQ\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Sending mails from WordPress Docker container - Sascha Brockel","description":"Sending emails from Docker containers does not work on WordPress without configuration. Receiving error messages by mail made easy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/","og_locale":"en_US","og_type":"article","og_title":"Mails aus WordPress (PHP) Docker Container senden","og_description":"E-Mails aus Docker Containern senden klappt bei WordPress nicht ohne Konfiguration. Fehlermeldungen per Mail erhalten leicht gemacht.","og_url":"https:\/\/sascha-brockel.de\/en\/send-mails-from-wordpress-docker-container\/","og_site_name":"Sascha Brockel","article_published_time":"2022-12-24T03:46:13+00:00","article_modified_time":"2024-01-20T02:23:19+00:00","og_image":[{"width":3999,"height":2666,"url":"https:\/\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg","type":"image\/jpeg"}],"author":"Sascha Brockel","twitter_card":"summary_large_image","twitter_creator":"@saschabrockel","twitter_site":"@saschabrockel","twitter_misc":{"Written by":"Sascha Brockel","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#article","isPartOf":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/"},"author":{"name":"Sascha Brockel","@id":"https:\/\/sascha-brockel.de\/#\/schema\/person\/3675ac2cf16fa04c60aca4dedca5c970"},"headline":"Mails aus WordPress (PHP) Docker Container senden","datePublished":"2022-12-24T03:46:13+00:00","dateModified":"2024-01-20T02:23:19+00:00","mainEntityOfPage":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/"},"wordCount":2231,"commentCount":0,"publisher":{"@id":"https:\/\/sascha-brockel.de\/#\/schema\/person\/3675ac2cf16fa04c60aca4dedca5c970"},"image":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1","keywords":["Docker","E-Mail","Postfix","WordPress"],"articleSection":["Docker","Tipps &amp; Tricks","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#respond"]}],"copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/sascha-brockel.de\/en\/#organization"}},{"@type":"WebPage","@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/","url":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/","name":"Sending mails from WordPress Docker container - Sascha Brockel","isPartOf":{"@id":"https:\/\/sascha-brockel.de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#primaryimage"},"image":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1","datePublished":"2022-12-24T03:46:13+00:00","dateModified":"2024-01-20T02:23:19+00:00","description":"Sending emails from Docker containers does not work on WordPress without configuration. Receiving error messages by mail made easy.","breadcrumb":{"@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#primaryimage","url":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1","contentUrl":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1","width":3999,"height":2666,"caption":"WordPress-TitelbildWordPress-Titelbild"},{"@type":"BreadcrumbList","@id":"https:\/\/sascha-brockel.de\/mails-aus-wordpress-docker-container-senden\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/sascha-brockel.de\/"},{"@type":"ListItem","position":2,"name":"Mails aus WordPress (PHP) Docker Container senden"}]},{"@type":"WebSite","@id":"https:\/\/sascha-brockel.de\/#website","url":"https:\/\/sascha-brockel.de\/","name":"Sascha Brockel","description":"Progress knows no boundaries","publisher":{"@id":"https:\/\/sascha-brockel.de\/#\/schema\/person\/3675ac2cf16fa04c60aca4dedca5c970"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sascha-brockel.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/sascha-brockel.de\/#\/schema\/person\/3675ac2cf16fa04c60aca4dedca5c970","name":"Sascha Brockel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2023\/10\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1","url":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2023\/10\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1","contentUrl":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2023\/10\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1","width":709,"height":945,"caption":"Sascha Brockel"},"logo":{"@id":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2023\/10\/Brockel_Sascha_3_3zu4-Grau.png?fit=709%2C945&ssl=1"},"sameAs":["https:\/\/sascha-brockel.de\/","https:\/\/www.instagram.com\/saschabrockel\/","https:\/\/www.linkedin.com\/in\/sascha-brockel-b20725164\/","https:\/\/x.com\/saschabrockel","https:\/\/www.youtube.com\/channel\/UCogo25FboCahP7s8--HDuIQ"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/sascha-brockel.de\/wp-content\/uploads\/2022\/12\/WordPress-Titelbild.jpg?fit=3999%2C2666&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/posts\/931","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/comments?post=931"}],"version-history":[{"count":31,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/posts\/931\/revisions"}],"predecessor-version":[{"id":1271,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/posts\/931\/revisions\/1271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/media\/959"}],"wp:attachment":[{"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/media?parent=931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/categories?post=931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sascha-brockel.de\/en\/wp-json\/wp\/v2\/tags?post=931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}