Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Email Invitations #31

Closed
philippneugebauer opened this issue Mar 2, 2021 · 21 comments
Closed

Email Invitations #31

philippneugebauer opened this issue Mar 2, 2021 · 21 comments

Comments

@philippneugebauer
Copy link

Have you thought about solutions for enabling email invitations?

When I try that, I get the following error:

sh: 1: /usr/sbin/sendmail: not found
@ckulka
Copy link
Owner

ckulka commented Mar 3, 2021

I figure installing sendmail is all that's needed (https://stackoverflow.com/questions/38299776/usr-sbin-sendmail-not-found/38299891). I'll post an update when I updated the Dockerfile, would you be able to test it then?

@philippneugebauer
Copy link
Author

yeah, for sure. I tried it and got stuck with the postfix installation :(

ckulka added a commit that referenced this issue Mar 3, 2021
@ckulka
Copy link
Owner

ckulka commented Mar 3, 2021

Ok, it's building now - based on previous Docker Hub builds, that'll take about 1.5h. Can you then please give it a try with one of the following (well, ideally both if you can) images?

  • ckulka/baikal:experimental-apache
  • ckulka/baikal:experimental-nginx

@philippneugebauer
Copy link
Author

Yeah, I found that SO answer, too. I am still not sure, if that's the right thing to do since that means to really host such an smtp server which comes with quite some effort. I think it would be nicer to be able to include a service or at least having it configured outside the baikal container?

@philippneugebauer
Copy link
Author

@philippneugebauer
Copy link
Author

I will provide a PR with my changes soon. It's working but I struggle to set the values in /etc/msmtprc with ENVs

@ahgraber
Copy link

@philippneugebauer I'm working on this myself.

Using the solution from the mchodled.com link, I think it's possible to mount the files as volumes, so the end user should just have an msmtprc or msmtp_php locally with their config, and it is mounted in the docker-compose:

#...
services:
  baikal:
    image: ckulka/baikal:nginx
    container_name: baikal
    restart: unless-stopped
    volumes:
      - ./config:/var/www/baikal/config
      - ./data:/var/www/baikal/Specific
      - ./msmtp_php:/etc/.msmtp_php

The real trick is to update the sendmail_path directly, and I think you'd have to rely on some bash scripting in the entrypoint/cmd scriptstart.sh. You could do something like:

sed -i 's/;sendmail_path =/sendmail_path = "/usr/bin/msmtp -C /etc/.msmtp_php --logfile /var/log/msmtp.log -a ${SENDMAIL_ACCOUNT} -t"/' /etc/php/8.0/fpm/php.ini

where SENDMAIL_ACCOUNT is an environmental variable

I haven't had time to test yet, though.

@philippneugebauer
Copy link
Author

philippneugebauer commented Mar 18, 2021

have you had a look at my PR? @ahgraber

@ahgraber
Copy link

Apologies, was moving fast trying to solve the same problem and just saw the comment about struggling to set values -- didn't see the PR link. Wasn't trying to be pedantic, just wanted to help :)

Your solution is specific to the :apache version?

@philippneugebauer
Copy link
Author

philippneugebauer commented Mar 18, 2021

I did not mean it like that, I rather wanted to point out the PR to get some feedback from you

I just haven't implemented it for nginx since I wanted to get some feedback first to avoid duplicate work

@ahgraber
Copy link

I'll follow up with comments on the PR itself.

@lennvilardi
Copy link

Is this problem closed ? Is there a tutorial to use email invites ?

@philippneugebauer
Copy link
Author

there is a possible option in #32

@MrPinrel
Copy link

MrPinrel commented Dec 2, 2021

I recently installed this container (great work!) on my Synology NAS and would love to get the email invites working. How would I go about enabling this? Do I need to download the experimental nginx version? Or is it going to get included in the latest release soon?

Happy to be a tester but would need some help on how to get started. Also, I use a mail relay, not sure if this makes a difference?

@philippneugebauer
Copy link
Author

build the dockerfile from #32 on your own and use it

@MrPinrel
Copy link

MrPinrel commented Dec 5, 2021

build the dockerfile from #32 on your own and use it

Thanks, I got it to build but it is complaining that msmtprc is not installed in the synology box. I found msmtprc and tried to install it, but it tells me that there is no suitable C compiler found to do that....now trying to figure out how to install that. Let me know if you have any ideas.

For a broader distribution it might be good to include those steps in the automated installation.

@MrPinrel
Copy link

update, I'm not having any luck getting msmtprc to build in my synology box. I get errors about libraries missing and errors in the MAKE file. Does anybody know where I could find the already built images? It is a DS918+ with the Intel Celeron processor.

@lennvilardi
Copy link

Seriously considering installing Nextcloud just to get email notification, it's too complicated to compile msmtp for a DS918+... is there another way (simplier?) ?

@MrPinrel
Copy link

Seriously considering installing Nextcloud just to get email notification, it's too complicated to compile msmtp for a DS918+... is there another way (simplier?) ?

Lenn thanks for this note, it caused me to look into installing nextcloud to a caldav server with working invites running on DSM 7.0. I followed these instructions and it was really easy. First I tried to install in Docker but then I decided to do the native install.

@vaskozl
Copy link

vaskozl commented Jan 9, 2022

I've been a happy radicale user for a few years now, after initially migrating away a couple of years ago. The reason was wanting to be able to send calendar invites for personal events, e.g. holiday flights.

I've managed to use sendmail as included by the experimental images but that required a number of hacks:

  • One obviously needs to the sendmail daemon.

  • The first problem one might encounter is that sendmail needs a FQDN in the hosts file, otherwise it hangs for a minute every time a mail is sent. (and the daemon is started). One needs to add to the hosts file. You can't even use sed -i directly due to the hosts file being mounted (and not moveable).

  • Your mail wil literally not be accepted by anyone unless you have a proper mail server e.g. postfix somewhere on the network. You can do this by adding a SMART_HOST to sendmail.mc

  • Even then, your emails may still go to spam, because the mail() function as used by postfix doesn't set the envelope sender (via the -fflag)

This is the command I'm using that actually delivers mail properly to gmail and the like:

              mv /usr/sbin/sendmail /usr/sbin/sendmail-og && 
              echo '#!/bin/sh' > /usr/sbin/sendmail && chmod +x /usr/sbin/sendmail &&  
              echo '/usr/sbin/sendmail-og -f [email protected] $@' >> /usr/sbin/sendmail &&
              echo 'nginx' >> /etc/mail/trusted-users &&
              echo "define(\`SMART_HOST', \`mail.yourlocal.domain')dnl" >> /etc/mail/sendmail.mc &&
              cp /etc/hosts /etc/hosts.new && 
              sed -i "s/$HOSTNAME/$HOSTNAME baikal.yourlocal.domain/" /etc/hosts.new && 
              cp /etc/hosts.new /etc/hosts && 
              service sendmail start && 
              /etc/init.d/php8.0-fpm start && 
              chown -R nginx:nginx /var/www/baikal/Specific && 
              nginx -g "daemon off;"

If any one is interested in the k8s manifest I used:
vaskozl/home-infra@9bbdf3d

@ckulka
Copy link
Owner

ckulka commented Jan 13, 2022

Thanks all, especially @philippneugebauer and @vaskozl. My proposal below is basically just a mix of #32 and #31 (comment).

Would like to hear what you think of this:

  1. The Docker image won't contain a mail server, it will rely on an external one (another container or a service like Gmail)

  2. The container will use sendmail and not msmtp

    Seems like sendmail is more widely adopted (https://trends.google.de/trends/explore?q=sendmail,msmtp), looks like being more of the default option to go with, and judging from the releases both are about equally frequently maintained.

    It also seems easier to use mounted secrets with sendmail compared to msmtp.

  3. Sendmail configuration will be applied during container start using three environment variables: the host, the "from" email address, and the additional sendmail.mc configuration

The docker-compose.yaml file would look like this:

version: '2'
services:
  baikal:
    image: ckulka/baikal:nginx
    environment:
      BAIKAL_SERVERNAME: baikal.yourdomain.com
      SENDMAIL_FROM: [email protected]
      SENDMAIL_MAILER_DEFINITIONS: |
        define(\`SMART_HOST', \`mail.yourdomain.com')dnl

The SENDMAIL_FROM environment variable with a prefixed -f flag is added to mail.force_extra_parameters in /etc/php/8.1/fpm/php.ini, so that we don't have to customize the /usr/sbin/sendmail script.

The SENDMAIL_MAILER_DEFINITIONS environment variable is inserted into /etc/mail/sendmail.mc underneath MAILER_DEFINITIONS, according to Configure Sendmail it's important that it's right underneath it ¯\ _ (ツ)_/¯. It can have multiple lines to allow for more configuration like authentication.

The BAIKAL_SERVERNAME is inserted to /etc/hosts just like @vaskozl has it in the script. What I don't know/my question: is this the same as the FQDN where Baikal is accessed, or could this be a different one?

If it's always the same one, we can reuse BAIKAL_SERVERNAME which is already a (somewhat) required parameter for the Apache image. If it can be different, I'd opt for a different variable name.

Repository owner locked and limited conversation to collaborators Jan 13, 2022
@ckulka ckulka converted this issue into discussion #61 Jan 13, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants