Emails sent with LF and not CRLF

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
Geronimoo
Posts: 4
Joined: Monday 09 July 2018 20:57
Target OS: -
Domoticz version:
Contact:

Emails sent with LF and not CRLF

Post by Geronimoo » Monday 09 July 2018 21:22

Version: 4.9747 2018-07-06
Platform: Windows 2008 R2
Plugin/Hardware: no extra plugins

Hi!

I recently configured the email thing in Setup->Email but noticed that my email clients (roundcube and webmail lite) did not display the e-mail correctly, no subject or body, a bit of the mail ended up in the To: field. I checked the .eml file on my email server and noticed that the linebreaks are only LF when they should be CRLF according to the email specification.
I wondered if it was my mailserver that might be doing silly things but I managed to capture the email packet using RawCap + Wireshark and it was LF there too.

Cheers

Geronimoo
Posts: 4
Joined: Monday 09 July 2018 20:57
Target OS: -
Domoticz version:
Contact:

Re: Emails sent with LF and not CRLF

Post by Geronimoo » Thursday 09 August 2018 3:58

bump

Geronimoo
Posts: 4
Joined: Monday 09 July 2018 20:57
Target OS: -
Domoticz version:
Contact:

Re: Emails sent with LF and not CRLF

Post by Geronimoo » Sunday 09 September 2018 23:51


JonathanLondon
Posts: 18
Joined: Sunday 31 December 2017 23:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Emails sent with LF and not CRLF

Post by JonathanLondon » Monday 10 September 2018 15:27

vikasaldana wrote:
Monday 10 September 2018 11:08
Recently some customers complained that they were getting garbled emails. MIME headers were showing, and base64 encoded data, etc. Stuff that should have been decoded by their mail clients.

After investigating I found that some mail clients (gmx.de webmail to name one) inserted a blank line after every other line, thus indeed messing everything up.

Following a hunch, I changed my mail sending code to replace all CRLF with just LF. And lo and behold - the mail arrived whole.

Now, this is weird, because RFC 5322 explicitly states tha
I have just submitted a patch to move from LF to CRLF and tested it with Exim (mail transport agent). Exim is pretty relaxed about LF versus CRLF but this has resolved a protocol violation Exim was complaining about:

Code: Select all

2018-09-10 12:44:02 SMTP protocol synchronization error (next input sent too soon: pipelining was advertised): rejected "" H=domoticz [192.168.1.60] next input=".\r\n"
This threw up another issue, where Domoticz was trying to send a dot on a line by itself to terminate the message body. libcurl maps this to a double dot, thinking it's part of the message. This shows up outside the HTML body of the message so it's pretty benign, but I have fixed it too.

I suspect the problem with gmx.de is that it's trying to cope with an invalid message, and not doing a great job. My patch should fix this.

I have NOT been able to test my patch on Windows, however.

Geronimoo
Posts: 4
Joined: Monday 09 July 2018 20:57
Target OS: -
Domoticz version:
Contact:

Re: Emails sent with LF and not CRLF

Post by Geronimoo » Tuesday 09 October 2018 19:47

I downloaded the beta and tried the new email code and it works very well!
Thanks a lot JonathanLondon!

Cheers

JonathanLondon
Posts: 18
Joined: Sunday 31 December 2017 23:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Emails sent with LF and not CRLF

Post by JonathanLondon » Saturday 13 October 2018 0:52

Pleased it's worked for you.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests