php / php/php-src

mail() truncates message on full stop between two newlines

未关闭
#12,632 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Extension: standard Feature
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先定位 PHP 的 mail() 实现,以及为本地邮件传输序列化邮件正文的路径。然后复现提供的 PHP 8.0.12 示例,再添加或更新回归测试,以确保仅包含一个句点的行能够被保留,并发送完整的预期正文。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。