Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

EmailRelay() Handling of carrige return and line feed


moho Mar 8, 2017 04:47 PM

Hi,

could you explain and verify the handling of carrige return and line feed according to your CRBasic EmailRelay() example in the help. I assume, that mutiple usage of CRLF will be handled incorrectly.


tmecham Mar 8, 2017 07:42 PM

I have confirmed that all CRLF are sent when using the CRBasic example.  The problem is that most email clients will remove extra lines when displaying the message.  The other issue is that the message is actually sent as a multi-part message with both plain text and html formats.  The HTML version of the message strips the extra CRLF and puts each line in a <p></p>.

Here is the raw content from the message source without the headers:

------------=_1489000570-5523-46
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

Warning!

This is a automatic email message from the datalogger station TYLER-CR6. An=
 alarm condition has been identified. The temperature is 24.64749 degrees C=
.


Datalogger time is 03/08/2017 12:15:49=20

 -------------------------------- =20
 Provided as a free service by Campbell Scientific
------------=_1489000570-5523-46
Content-Type: text/html; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

<html><body>
<p>Warning!</p>
<p>This is a automatic email message from the datalogger station TYLER-CR6.=
 An alarm condition has been identified. The temperature is 24.64749 degree=
s C.</p>
<p>Datalogger time is 03/08/2017 12:15:49</p>
<pre>--------------------------------
Provided as a free service by Campbell Scientific</pre>
</body></html>

------------=_1489000570-5523-46--


moho Mar 9, 2017 12:08 PM

Hi tmecham, you are right.

The "Content-Type: text/plain; charset=UTF-8" will be formatted correctly and according to the CRBasic instructions of CRLF.

The "Content-Type: text/html; charset="UTF-8", does not validate the multiple CRLF correctly.

Are there possibilities to control this by calling the functions with extra parameters, maybe in later OS updates? Or can you provide a best practice of formatting the mail. Sending mail only as text/plain is fine, having the option of text/html would offer the opportunity to bring some corporate design or style in it, if it will be parsed correctly. ;)

edit:

Just read some docs on: https://sendgrid.com/docs/Classroom/Build/Format_Content/plain_text_emails_converted_to_html.html It ends in more complex subject as you have to change sendgrids global settings.

Anyhow, maybe you can extend your CRBasic help to show examples corresponding to your sendgrid settings to format mails, which will look as the CRBasic instructions.


moho Mar 24, 2017 07:49 AM

Hi,
did you changed global settings?
I received an email only in text.

Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Thu, 23 Mar 2017 21:54:18 +0000
From: emailrelay@konectgds.com
Mime-Version: 1.0

 Now it looks like it is coded in CRBasic.

Thx


aps Mar 24, 2017 12:29 PM

A change was made yesterday to try and reduce the risk of the email being detected as SPAM.   I will check but I do not think that should have supressed the HTML version altogether.


moho Mar 24, 2017 12:49 PM

Hi aps,
now mails will only be send as text, instead of multi-part message. (Which is by the way, fine.)

Log in or register to post/reply in the forum.