dongyun65343 2017-01-13 18:26
浏览 225

如何从Docker容器中的Wordpress发送电子邮件?

I have a little issue with Wordpress image, will be thankful for any help.

I have existing database, which I import with dump.

My Mysql Dockerfile listing below:

FROM mariadb:10.1.20

COPY dump/dump.sql /docker-entrypoint-initdb.d

ENV MYSQL_ROOT_PASSWORD pass

CMD ["mysqld"]

This is Wordpress Dockerfile, here I import my wp-content folder from src directory:

FROM wordpress:latest

COPY ./src /var/www/html

ENV WORDPRESS_DB_PASSWORD pass
ENV WORDPRESS_DB_NAME db
ENV WORDPRESS_DB_HOST mysql:3306

And of course docker-compose.yml file:

version: '2'

services:
  mysql:
    build: mysql/
    restart: always
    volumes:
      - db_data:/var/lib/mysql
    container_name: mysql
  vshvetsov:
    depends_on:
      - mysql
    build: wordpress/
    ports:
      - 8000:80
    restart: always
    container_name: wordpress
volumes:
    db_data:

When I use plugin Contact Form 7 i've got an error with sending email after click button and of course don't get this message in my mailbox.

The only thing what I've found is this message:

172.18.0.1 - - [13/Jan/2017:13:52:42 +0000] "POST /const HTTP/1.1" 200 879 "http://localhost:8000/contacts" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
sh: 1: -t: not found

I've tried to install sendmail, but it still didn't help.

Thank you all for help.

I saw this issue, but it's not fixed at this moment.

  • 写回答

1条回答 默认 最新

  • douwen5066 2019-03-07 01:18
    关注

    You can install ssmtp, as in : https://github.com/xgodon/RIG/blob/master/dockerized-apps/wordpress/Dockerfile

    you just need a ssmtp.conf file like

    mailhub=smtp.gmail.com:587
    AuthUser=xxx@mail.com
    AuthPass=
    UseSTARTTLS=YES
    # Allow the "From" email header.
    FromLineOverride=YES
    

    there is a delay (beacause no qualified host name) in the sending but here is the solution : https://www.digitalocean.com/community/questions/sendmail-is-slow-to-send-mail

    i'll update the Dockerfile soon.

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?