[Issue 8540] New: std.net.curl.SMTP doesn't escape leading dots

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 11 15:48:07 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8540

           Summary: std.net.curl.SMTP doesn't escape leading dots
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: destructionator at gmail.com


--- Comment #0 from Adam D. Ruppe <destructionator at gmail.com> 2012-08-11 15:48:00 PDT ---
Consider the following:

void main() {
    auto smtp = SMTP("smtp://localhost");
    smtp.mailTo = ["<me>"];
    smtp.mailFrom = "<me>";
    smtp.message = "cool
.test
does this have a bug?
    ";
    smtp.perform();
}

I received:

cool
test
does this have a bug?


Worse is if the message is:

"cool
.
does this have a bug?"


in which case it comes in as just

"cool"





I've encountered this same bug in another smtp app too, it seems to be a tricky
one people miss, but it can happen in the real world especially if you are
sending html emails.


The fix isn't too hard though. When you're sending the data and encounter a
leading period in a line in the message, just prepend another period to it when
sending down the smtp connection.


"cool\n.\nmore" is sent as "cool\n..\nmore"


and then the recipient will get the right message.




Another thing to watch out for that std.net.curl seems to miss is a message
that starts with the word "From".

smtp.message = "From something
more";


That first line gets cut off. The convention to fix this is to prepend the line
with the > character.


smtp is kinda weird :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list