mail() truncates message on full stop between two newlines
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
mail("myself@mydomain.com", "Subject whatever", "Foo bar\n\nWhatever\n\n.\n\nLorem ipsum dolor sit amet");
Resulted in this email body being sent:
Foo bar
Whatever
(not sure whether with or without the \ns at the end and how many of them)
But I expected this output instead:
Foo bar
Whatever
.
Lorem ipsum dolor sit amet
I know that a line with only a full stop is how the email body is terminated in the SMTP protocol, but this is not the SMTP protocol, this is a php function that takes a message and sends it via email. If the caller is supposed to encode the message the way it would be encoded in the SMTP protocol, the docs should say so; but again, that would be stupid.
PHP Version
8.0.12
Operating System
debian 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating PHP's mail() implementation and the path that serializes message bodies for the local mail transport. Reproduce the provided PHP 8.0.12 example, then add or update a regression test so a line containing only a period is preserved and the complete expected body is sent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100