在docker-compose中为WordPress设置SMTP

时间:2019-05-30 04:58:17

标签: wordpress docker smtp settings

我正在尝试为联系表单和约会插件启用WordPress SMTP邮件。我的WordPress在Docker容器中运行。我的SMTP服务器需要充当邮件中继。

我很确定我需要具有端口配置的SMTP docker映像,但是我不确定我需要哪个映像以及如何将其合并到docker-compose中。

这是我的docker-compose文件

version: '3'

services:
  # Database
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: *******
      MYSQL_DATABASE: *******
      MYSQL_USER: *******
      MYSQL_PASSWORD: *******
    networks:
      - wpsite
  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8080:80'
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: *******
    networks:
      - wpsite
  # Wordpress
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    ports:
      - '8000:80'
    restart: always
    volumes: ['./:/var/www/html']
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: *******
      WORDPRESS_DB_PASSWORD: *******
    networks:
      - wpsite
networks:
  wpsite:
volumes:
  db_data:

现在WP Mail SMTP返回此错误:

An issue was detected.

This means your test email was unable to be sent.

Typically this error is returned for one of the following reasons:

- Plugin settings are incorrect (wrong SMTP settings, invalid Mailer configuration, etc).
- Your web server is blocking the connection.
- Your host is rejecting the connection.

0 个答案:

没有答案