Missing Linebreaks when sending Mails with CURL from Windows

Hello,

i am using MBS CURL(S) to send Mails from Macintosh and Windows Machines. Mails sent from a Macintosh (Mavericks) by using the following code, are fine. Mails sent from Windows Machines with the same code are missing most linebreaks. It looks like multiple linebreaks are replaced by single linebreaks. I assume it has something todo with the Encoding or with the kind of EndOfLines, but i can’t find a solution by myself.

[code] // we store stuff in variables here to avoid the ThreadAccessingUIException

Dim em as new EmailMessage

em.AddRecipient OptionMailRecipients

em.Headers.AppendHeader “Mime-Version”, “1.0”
em.Headers.AppendHeader “Content-type”, “text/plain; charset=iso-8859-15”
em.Headers.AppendHeader “Content-Transfer-Encoding”, “8bit”
em.Headers.AppendHeader “Content-Language”, “de-DE”
em.Headers.AppendHeader “X-Mailer”, “WAG5 Mailer”
em.Headers.AppendHeader “Reply-To”, “some@mailadress.com

em.Subject = Betreff.Text
em.BodyPlainText = Nachricht.Text
em.BodyEnriched = Nachricht.Text

em.Attachments = Anhaenge

UploadData = em.source

Thread1.run[/code]

Did you try ReplaceLineEnding function here with the em.source?
e.g. replace with EndOfLine.Windows?

No, but i tried now this way:

UploadData = ReplaceLineEndings(em.source, EndOfLine.Windows)

And does not work too.

Strange is. I load the Text for the Body from a mySQL Database (as WindowsANSI) into a TextArea and it fails. But if i enter the text manually into my TextArea, it works just as expected?

No, i was wrong! Both methods won’t work :frowning:

Here is an example of an original text as it’s copied from the Database into the TextArea:

[code]Sehr geehrte Kundin, sehr geehrter Kunde,

vielen Dank für Ihre Anfrage.

Wir haben Ihre Nachricht erhalten und werden uns falls erforderlich, in Kürze mit Ihnen in Verbindung setzen.[/code]

and this is how it looks like in the received Mail:

Sehr geehrte Kundin, sehr geehrter Kunde, vielen Dank für Ihre Anfrage. Wir haben Ihre Nachricht erhalten und werden uns falls erforderlich, in Kürze mit Ihnen in Verbindung setzen.

Did you try other line endings?

Yes. I tried all of them. All the same.

Maybe make sure the line contains at least a space character, so it’s not removed?

Same issue.
BTW: The debugger shows that em…Text holds the String as it should be, but somehow it must “loose” information in CURL when the text has been written and sent from a Windows (7 32Bit) machine.

I am sure it is related to the encoding. I am now using the following code, but still have the same issue: :frowning:

[code] Dim em as new EmailMessage
Dim BetreffText,BodyText As String
BetreffText = Betreff.Text
BodyText = Nachricht.Text
BetreffText = BetreffText.ConvertEncoding(Encodings.WindowsLatin1)
BodyText = BodyText.ConvertEncoding(Encodings.WindowsLatin1)

em.AddRecipient OptionMailRecipients

em.Headers.AppendHeader “Mime-Version”, “1.0”
em.Headers.AppendHeader “Content-type”, “text/plain; charset=iso-8859-1”
em.Headers.AppendHeader “Content-Transfer-Encoding”, “8bit”
em.Headers.AppendHeader “Content-Language”, “de-DE”
em.Headers.AppendHeader “X-Mailer”, “WAG5 Mailer”
em.Headers.AppendHeader “Reply-To”, “some@mailadress.com

em.Subject = EncodingToISO8859MBS(BetreffText)
em.BodyPlainText = BodyText
em.BodyEnriched = BodyText

em.Attachments = Anhaenge

UploadData = em.source
[/code]

I just tried my example here and it seems to work fine for me. Code similar to what you have above.

Do you think, it could be something “wrong” with the SMTP Server (MS Exchange)?

Sorry, no idea about your server.
You could of course use a sniffer to see if the linefeeds go though the internet connection.

Thank you Christian for your kind help.
I think i will leave it as it is for a while and continue with other parts of my project until i have the time for another try :slight_smile:

Look at your email client. Outlook (for instance) removes extra empty lines by default.

Thank you Greg. I already verified this with iCloud in Firefox an Apple Mail on Mavericks. :slight_smile:

After further research I found out, the double line breaks when they are written on a Macintosh are not filtered out in an email client. But if i send the same mail from a Windows machine, these extra line breaks are actually filtered out by the mail client.

It’s an effect with which I can live… :slight_smile: