mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-12-21 23:08:54 -05:00
Discard periods prefixing SMTP data per RFC 821 4.5.2
This commit is contained in:
parent
cfdadc01fd
commit
20cf6e98f1
14
examples/dotmail
Normal file
14
examples/dotmail
Normal file
@ -0,0 +1,14 @@
|
||||
To: Blah <blah@blah.com>
|
||||
From: Me <me@sj26.com>
|
||||
Subject: Whatever
|
||||
Content-Type: text/plain
|
||||
|
||||
Plain text mail
|
||||
|
||||
With some dot lines:
|
||||
|
||||
.
|
||||
|
||||
...
|
||||
|
||||
Done.
|
@ -34,7 +34,10 @@ class MailCatcher::Smtp < EventMachine::Protocols::SmtpServer
|
||||
|
||||
def receive_data_chunk(lines)
|
||||
current_message[:source] ||= ""
|
||||
current_message[:source] += lines.join("\n")
|
||||
lines.each do |line|
|
||||
# RFC821 4.5.2 says leading periods should be stripped from the body data.
|
||||
current_message[:source] << line.sub(/\A\./, "") << "\n"
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user