Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Autoconfigure mail in docker-compose production #341

Closed
Jesterboxboy opened this issue May 9, 2023 · 2 comments · Fixed by #363
Closed

Enhancement Autoconfigure mail in docker-compose production #341

Jesterboxboy opened this issue May 9, 2023 · 2 comments · Fixed by #363

Comments

@Jesterboxboy
Copy link
Contributor

Jesterboxboy commented May 9, 2023

It would be very comfortable if the functionality to send recovery and signup mails via smarthost would work out of the box with docker compose.

Tested Steps to make it work:

  • Add Environment Variables to env file for Docker Compose
   FROM_MAIL=Pantheon<pantheon@domain.test>`
   SMTP_HOST=mail.domain.test:587
   SMTP_USER=user@domain.test
   SMTP_PASS=password
   SMTP_TLS=YES
   SMTP_STARTTLS=YES
  • apk add ssmtp in Frey container

  • Add configuration for ssmtp to /etc/ssmtp/ssmtp.conf filled with env variables

  # cat /etc/ssmtp/ssmtp.conf 
  # Config file for sSMTP sendmail 
  #
  # The person who gets all mail for userids < 1000
  # Make this empty to disable rewriting.
  root=

  # The place where the mail goes. The actual machine name is required no
  # MX records are consulted. Commonly mailhosts are named mail.domain.com
  mailhub=SMTP_HOST

  # Where will the mail seem to come from?
  rewriteDomain=

  # The full hostname
  hostname=pantheon

  # Are users allowed to set their own From: address?
  # YES - Allow the user to specify their own From: address
  # NO - Use the system generated From: address
  FromLineOverride=YES

  AuthUser=SMTP_USER
  AuthPass=SMTP_PASS
  UseTLS=SMTP_TLS
  UseSTARTTLS=SMTP_STARTTLS
  • Add FROM Header i.e. in send function in Mailer class in Frey/src/helper/Mailer.php
    protected function _send(string $to, string $subject, string $message, array
     $additionalHeaders, string $additionalParams)
    {
        $boundary = md5(uniqid() . microtime());
        $additionalHeaders['Content-Type'] = 'multipart/alternative; boundary="' . $boundary .      '"';
        $additionalHeaders['From'] = SMTP_FROM;

@Jesterboxboy
Copy link
Contributor Author

I will try to make it work in a branch, and create a PR request

@ctizen
Copy link
Member

ctizen commented Jun 11, 2023

@Jesterboxboy I added a separate container with email agent, I think it should resolve this issue. Updated the readme with infomation about how to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants