Can anyone tell me how to add newlines to an email message body when using eMessage.Body ?
I am running LO 5.1.6.2 on Linux MINT 18.2.
For example:
eMsg = "Dear sir,\n\n"
eMsg = "This is a polite reminder of your next appointment.\n\n"
eMsg = "Appointment date: " & aDate & "\n"
eMsg = "Appoitment time: " & aTime & "\n"
eMsg = ... etc, etc, etc
eMailer = createUnoService("com.sun.star.system.SimpleCommandMail")
eMessage = eMailer.createSimpleMailMessage()
eMessage.Recipient = eMailAddr
eMessage.Subject = "Your next appointment " + dTdate
eMessage.Body = eMsg
eMailer.sendSimpleMailMessage (eMessage, com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE)
When the message is opens in Thunderbird, all of the text is on one continuous line. I have also tried & chr(10) & chr(13) as well as %0A %0D without any success
I have also used:
eMessage.Body = "Dear sir,\n\n"
eMessage.Body = eMessage.Body + "This is a polite reminder of your next appointment..."
etc
It makes no difference. I need to compose a message body that consists of several lines of text. Surely this must be possible? I have done it before in Python, Perl etc, but it seems not to work in LO?
UPDATE: I hit upon the idea of displaying the body of the message (either eMsg or eMessage.Body) using MsgBox. I then found that Chr(10) or Chr(13) with upper case ‘C’ does indeed insert line breaks. I have therefore revised the above to:
eMsg = "Dear sir," + Chr(13) + Chr(13)
eMsg = eMsg + "This is a polite reminder of your next appointment." + Chr(13) + Chr(13)
eMsg = eMsg + "Appointment date: " + aDate + Chr(13)
eMsg = eMsg + "Appoitment time: " + aTime + Chr(13)
eMsg = eMsg + "... etc, etc, etc"
eMailer = createUnoService("com.sun.star.system.SimpleCommandMail")
eMessage = eMailer.createSimpleMailMessage()
eMessage.Recipient = eMailAddr
eMessage.Subject = "Your next appointment " + dTdate
eMessage.Body = eMsg
eMailer.sendSimpleMailMessage (eMessage, com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE)
Unfortunately, Thunderbird still produces just one long line of text in the body of the message.