You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
.
more" is sent as "cool
..
more"
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 :)
The text was updated successfully, but these errors were encountered:
Oh, wait a minute on the From thing... I guess the headers can be part of the message. That's actually good, makes it easier to use for fancier things.
Might want to change the documentation: it says "Sets the message body text." but if it can include headers as well, might want to note that.
I'm not sure how curl does the separation... but eh however it works we should make it clear.
smtp.message = "X-Test: awesome
Content-Type: text/html
cool";
From: destructionator@gmail.com
X-Test: awesome
[-- text/html is unsupported (use 'v' to view this part) --]
So yeah those took as headers.
But this is getting a little off topic... the dot escaping needs to be done regardless.
destructionator (@adamdruppe) reported this on 2012-08-11T15:48:00Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=8540
CC List
Description
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 . more" is sent as "cool .. more" 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 :)The text was updated successfully, but these errors were encountered: