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 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度