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

mail function works incorrectly in PHP8 alpine builds #1327

Closed
speller opened this issue Aug 30, 2022 · 5 comments
Closed

mail function works incorrectly in PHP8 alpine builds #1327

speller opened this issue Aug 30, 2022 · 5 comments

Comments

@speller
Copy link

speller commented Aug 30, 2022

I'm using latest PHP 8.1 alpine image with the following sendmail version:

/magento # sendmail --help
BusyBox v1.34.1 (2022-07-19 20:11:24 UTC) multi-call binary.

The mail function sends headers and body with \r\n line delimiters according to standards and passes this data to sendmail. But sendmail converts all line-endings to \r\r\n making the whole mail broken.

A related issue in the PHP repo: php/php-src#8086 (closed as PHP does everything correctly).

@wglambert
Copy link

I'm guessing it's busybox-specific, have you tried the non-alpine version?

@tianon
Copy link
Member

tianon commented Aug 30, 2022

Yeah, that seems pretty busybox-specific (and I can't imagine sendmail in busybox really does what you'd expect from a "proper" working sendmail configuration even if it didn't have whatever this quirk is 😅).

https://pkgs.alpinelinux.org/contents?file=sendmail&branch=v3.16&arch=x86_64 includes a few alternative options you should probably consider installing in your image. 👀

For further help, I would suggest a dedicated support forum, such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@tianon tianon closed this as completed Aug 30, 2022
@speller
Copy link
Author

speller commented Sep 1, 2022

@wglambert @tianon I suppose you as the maintainers should be aware of the issue because one of the basic PHP features is non-functional in Alpine images. This is not a bug of PHP, this may be a bug of Busybox, but why users of the image should apply workarounds and not maintainers? Of course, I will do something because I need it, but I think the way when core PHP functionality doesn't work because maintainers don't care is not the best way.

@speller
Copy link
Author

speller commented Sep 1, 2022

@wglambert

have you tried the non-alpine version?

How can I do that?

@speller
Copy link
Author

speller commented Sep 1, 2022

@tianon

includes a few alternative options you should probably consider installing in your image

I just tried ssmtp but the result is the same.

Here is the beginning of an email:

Message-ID: [email protected]
Received: from a1056cb82c1a by mailhog.example (MailHog)
          id [email protected]; Thu, 01 Sep 2022 01:01:48 +0000
Return-Path: <php@a1056cb82c1a>

Received: by a1056cb82c1a (sSMTP sendmail emulation); Thu, 01 Sep 2022 01:01:48 +0000
From: php@a1056cb82c1a
To: =?utf-8?Q?ssdfsdf?= <[email protected]>

Subject: =?UTF-8?Q?[#EVA-60262]=20Ticket=20created:=20Order=20-=20I=20want=20to=20?=

 =?UTF-8?Q?know=20the=20status=20of=20my=20order.?=

Date: Thu, 01 Sep 2022 01:01:43 +0000

MIME-Version: 1.0

Content-Type: text/html;

 charset="utf-8"

Content-Transfer-Encoding: quoted-printable

Content-Disposition: inline



<!-- HDU_REPLY_MARKER --><br><div class=3D"aw-hdu-reply-marker">Please t=

ype your reply above this line.</div><br><!DOCTYPE html PUBLIC "-//W3C//=

DTD XHTML 1.0 Strict//EN" "http:https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict=

=2Edtd">=0A<html xmlns=3D"http:https://www.w3.org/1999/xhtml" style=3D"font-size=

: 62.5%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; fon=

t-size-adjust: 100%; background-color: #fff;">=0A<head>=0A    <meta http=

-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">=0A    <m=

eta name=3D"viewport" content=3D"initial-scale=3D1.0, width=3Ddevice-wid=

th">=0A    <meta http-equiv=3D"X-UA-Compatible" content=3D"IE=3Dedge">=

=0A    <style type=3D"text/css">=0A        .aw-hdu-note {color: gray; fo=

nt-size: 85%;} .aw-hdu-reply-marker {background-color: lightgray; font-s=

ize: 85%; text-align: center;}=0A=0A        @import url("https://maxcdn.=

bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");=0Ahtml {=

=0A  font-size: 62.5%;=0A  -webkit-text-size-adjust: 100%;=0A  -ms-text-= 

All mail data sent from PHP has extra line breaks.

Can it be that something is wrong on the OS level, not on the application level?

@speller speller changed the title sendmail works incorrectly in PHP8 alpine builds mail function works incorrectly in PHP8 alpine builds Sep 1, 2022
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

No branches or pull requests

3 participants