Skip to content

Commit d0a4053

Browse files
MCLOUD-5624: Unable to enable sending email in the docker (#255)
1 parent f427b8f commit d0a4053

29 files changed

+129
-42
lines changed

images/php/7.1-cli/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ENV DEBUG false
99
ENV MAGENTO_RUN_MODE production
1010
ENV UPDATE_UID_GID false
1111
ENV COMPOSER_ALLOW_SUPERUSER 1
12+
ENV ENABLE_SENDMAIL true
1213

1314
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1415

@@ -28,8 +29,6 @@ RUN apt-get update \
2829
python3 \
2930
python3-pip \
3031
redis-tools \
31-
sendmail \
32-
sendmail-bin \
3332
sudo \
3433
unzip \
3534
vim \
@@ -66,6 +65,11 @@ RUN pip3 install --upgrade setuptools \
6665
# Install Grunt
6766
RUN npm install -g grunt-cli
6867

68+
# Install MailHog
69+
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
70+
&& sudo chmod +x mhsendmail_linux_amd64 \
71+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
72+
6973
# Configure the gd library
7074
RUN docker-php-ext-configure \
7175
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

images/php/7.1-cli/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ PHP_EXT_DIR=/usr/local/etc/php/conf.d
4242

4343
# Configure Sendmail if required
4444
if [ "$ENABLE_SENDMAIL" == "true" ]; then
45-
sed -i "s/!SENDMAIL_PATH!/\/usr\/sbin\/sendmail -t -i/" ${PHP_EXT_DIR}/zz-mail.ini
46-
/etc/init.d/sendmail start
45+
sed -i "s/!SENDMAIL_PATH!/\"\/usr\/local\/bin\/mhsendmail --smtp-addr=mailhog:1025\"/" ${PHP_EXT_DIR}/zz-mail.ini
4746
else
4847
sed -i "s/!SENDMAIL_PATH!/\"true > \/dev\/null\"/" ${PHP_EXT_DIR}/zz-mail.ini
4948
fi

images/php/7.1-fpm/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ENV DEBUG false
88
ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
11+
ENV ENABLE_SENDMAIL true
1112

1213
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mcrypt mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1314

@@ -16,8 +17,6 @@ RUN apt-get update \
1617
&& apt-get upgrade -y \
1718
&& apt-get install -y --no-install-recommends \
1819
apt-utils \
19-
sendmail-bin \
20-
sendmail \
2120
sudo \
2221
libbz2-dev \
2322
libjpeg62-turbo-dev \
@@ -45,6 +44,11 @@ RUN apt-get update \
4544
zip \
4645
&& rm -rf /var/lib/apt/lists/*
4746

47+
# Install MailHog
48+
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
49+
&& sudo chmod +x mhsendmail_linux_amd64 \
50+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
51+
4852
# Configure the gd library
4953
RUN docker-php-ext-configure \
5054
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

images/php/7.1-fpm/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ PHP_EXT_DIR=/usr/local/etc/php/conf.d
3434

3535
# Configure Sendmail if required
3636
if [ "$ENABLE_SENDMAIL" == "true" ]; then
37-
sed -i "s/!SENDMAIL_PATH!/\/usr\/sbin\/sendmail -t -i/" ${PHP_EXT_DIR}/zz-mail.ini
38-
/etc/init.d/sendmail start
37+
sed -i "s/!SENDMAIL_PATH!/\"\/usr\/local\/bin\/mhsendmail --smtp-addr=mailhog:1025\"/" ${PHP_EXT_DIR}/zz-mail.ini
3938
else
4039
sed -i "s/!SENDMAIL_PATH!/\"true > \/dev\/null\"/" ${PHP_EXT_DIR}/zz-mail.ini
4140
fi

images/php/7.2-cli/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ENV DEBUG false
99
ENV MAGENTO_RUN_MODE production
1010
ENV UPDATE_UID_GID false
1111
ENV COMPOSER_ALLOW_SUPERUSER 1
12+
ENV ENABLE_SENDMAIL true
1213

1314
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1415

@@ -28,8 +29,6 @@ RUN apt-get update \
2829
python3 \
2930
python3-pip \
3031
redis-tools \
31-
sendmail \
32-
sendmail-bin \
3332
sudo \
3433
unzip \
3534
vim \
@@ -65,6 +64,11 @@ RUN pip3 install --upgrade setuptools \
6564
# Install Grunt
6665
RUN npm install -g grunt-cli
6766

67+
# Install MailHog
68+
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
69+
&& sudo chmod +x mhsendmail_linux_amd64 \
70+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
71+
6872
# Configure the gd library
6973
RUN docker-php-ext-configure \
7074
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

images/php/7.2-cli/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ PHP_EXT_DIR=/usr/local/etc/php/conf.d
4242

4343
# Configure Sendmail if required
4444
if [ "$ENABLE_SENDMAIL" == "true" ]; then
45-
sed -i "s/!SENDMAIL_PATH!/\/usr\/sbin\/sendmail -t -i/" ${PHP_EXT_DIR}/zz-mail.ini
46-
/etc/init.d/sendmail start
45+
sed -i "s/!SENDMAIL_PATH!/\"\/usr\/local\/bin\/mhsendmail --smtp-addr=mailhog:1025\"/" ${PHP_EXT_DIR}/zz-mail.ini
4746
else
4847
sed -i "s/!SENDMAIL_PATH!/\"true > \/dev\/null\"/" ${PHP_EXT_DIR}/zz-mail.ini
4948
fi

images/php/7.2-fpm/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ENV DEBUG false
88
ENV MAGENTO_RUN_MODE production
99
ENV UPLOAD_MAX_FILESIZE 64M
1010
ENV UPDATE_UID_GID false
11+
ENV ENABLE_SENDMAIL true
1112

1213
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1314

@@ -16,8 +17,6 @@ RUN apt-get update \
1617
&& apt-get upgrade -y \
1718
&& apt-get install -y --no-install-recommends \
1819
apt-utils \
19-
sendmail-bin \
20-
sendmail \
2120
sudo \
2221
libbz2-dev \
2322
libjpeg62-turbo-dev \
@@ -44,6 +43,11 @@ RUN apt-get update \
4443
zip \
4544
&& rm -rf /var/lib/apt/lists/*
4645

46+
# Install MailHog
47+
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
48+
&& sudo chmod +x mhsendmail_linux_amd64 \
49+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
50+
4751
# Configure the gd library
4852
RUN docker-php-ext-configure \
4953
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

images/php/7.2-fpm/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ PHP_EXT_DIR=/usr/local/etc/php/conf.d
3434

3535
# Configure Sendmail if required
3636
if [ "$ENABLE_SENDMAIL" == "true" ]; then
37-
sed -i "s/!SENDMAIL_PATH!/\/usr\/sbin\/sendmail -t -i/" ${PHP_EXT_DIR}/zz-mail.ini
38-
/etc/init.d/sendmail start
37+
sed -i "s/!SENDMAIL_PATH!/\"\/usr\/local\/bin\/mhsendmail --smtp-addr=mailhog:1025\"/" ${PHP_EXT_DIR}/zz-mail.ini
3938
else
4039
sed -i "s/!SENDMAIL_PATH!/\"true > \/dev\/null\"/" ${PHP_EXT_DIR}/zz-mail.ini
4140
fi

images/php/7.3-cli/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ENV DEBUG false
99
ENV MAGENTO_RUN_MODE production
1010
ENV UPDATE_UID_GID false
1111
ENV COMPOSER_ALLOW_SUPERUSER 1
12+
ENV ENABLE_SENDMAIL true
1213

1314
ENV PHP_EXTENSIONS bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
1415

@@ -28,8 +29,6 @@ RUN apt-get update \
2829
python3 \
2930
python3-pip \
3031
redis-tools \
31-
sendmail \
32-
sendmail-bin \
3332
sudo \
3433
unzip \
3534
vim \
@@ -63,6 +62,11 @@ RUN pip3 install --upgrade setuptools \
6362
# Install Grunt
6463
RUN npm install -g grunt-cli
6564

65+
# Install MailHog
66+
RUN wget https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
67+
&& sudo chmod +x mhsendmail_linux_amd64 \
68+
&& sudo mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
69+
6670
# Configure the gd library
6771
RUN docker-php-ext-configure \
6872
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

images/php/7.3-cli/docker-entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ PHP_EXT_DIR=/usr/local/etc/php/conf.d
4242

4343
# Configure Sendmail if required
4444
if [ "$ENABLE_SENDMAIL" == "true" ]; then
45-
sed -i "s/!SENDMAIL_PATH!/\/usr\/sbin\/sendmail -t -i/" ${PHP_EXT_DIR}/zz-mail.ini
46-
/etc/init.d/sendmail start
45+
sed -i "s/!SENDMAIL_PATH!/\"\/usr\/local\/bin\/mhsendmail --smtp-addr=mailhog:1025\"/" ${PHP_EXT_DIR}/zz-mail.ini
4746
else
4847
sed -i "s/!SENDMAIL_PATH!/\"true > \/dev\/null\"/" ${PHP_EXT_DIR}/zz-mail.ini
4948
fi

0 commit comments

Comments
 (0)