Skip to content

[Bug]: Double dots in links in emails #39594

Closed

Description

⚠️ This issue respects the following points: ⚠️

Bug description

As you can from this issue in Symfony symfony/symfony#50875 seems like the mailer adds double dots if a dot is matched as first character of a line (this is the code)
https://github.com/symfony/symfony/blob/acd9e3b9922b2f6064dc8bd1f77c52f7ce48ec69/src/Symfony/Component/Mailer/Transport/SendmailTransport.php#L105-L107

If you add the -i in the pipe (like this 'pipe' => ' -t -i')

$binaryParam = match ($this->config->getSystemValueString('mail_sendmailmode', 'smtp')) {
'pipe' => ' -t',
default => ' -bs',
};

This fixes the issue.

Symphony community is still trying to understand if this is a bug or not, but still this seems a solution.
What do you think? Can I do a PR for this?

This will resolve these issues too: #33754 and #16379

Steps to reproduce

  1. replace the sendmail binary with the postfix one (I don't know if this is required but I use this one) but stop all postfix daemons (or just run it in a container with a super dummy spool folder)
mkdir -p /var/spool/postfix/maildrop
chmod ugo+rwx  /var/spool/postfix /var/spool/postfix/maildrop
  1. set the mail_sendmailmode to pipe
  2. create many users with different string length (for example user1, user12, user123, user1234)
# create random users
export OC_PASS=Epi1cP4ssword
for i in {1..20}; do php occ user:add user$(python3 -c "print('1'*$i)") --password-from-env; done
# set the email
for i in {1..20}; do USERNAME=user$(python3 -c "print('1'*$i)"); php occ user:setting "$USERNAME" settings email "${USERNAME}.${USERNAME}@example.com"; done
  1. generate some emails (for example I send all the Welcome emails with the reset password link)
  2. check if there are duplicated dots in the postfix spool (grep random things that could appear in your Nextcloud url)
cd /var/spool/postfix/maildrop
postcat -bh * | grep lostpass -C2
  1. you will definitely find at least one user with a broken link
Imposta la tua password: https://mydrive.example.com/index=
..php/lostpassword/reset/form/3GOnnGyVaEBzs2JmuYXCU/utente123456

Expected behavior

Dots should not be doubled in emails

Installation method

Community Docker image

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
[...]
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "pipe",
[...]
    }
}

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions