Retain new line in field enter key behavior in email body

jjake

Registered User.
Local time
Today, 08:13
Joined
Oct 8, 2015
Messages
291
I'm using the following code to send an email from a form.

Code:
Private Sub Command68_Click()

Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Dim Header As String
Dim Text As String
Dim EmailAddr As String

Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)

MessageTo = fConcatEMailAddr

Subject = "Test"

MessageBody = "NC# " & Me.NCNum & "<br>" _
             & "Product Name: " & Me.PRODUCTNAME & "<br>" _
             & "Quantity: " & Me.Quantity & "lb" & "<br>" _
             & "<br>" _
             & "<u>QC Notes</U>" & "<br>" _
             & Me.NCDescription & "<br>"
             


With objMail
    .To = MessageTo
    .Subject = Subject
    .BodyFormat = olFormatHTML
    .HTMLBody = MessageBody
    .Send
    
End With

' Release all object variables
Set mItem = Nothing
Set olApp = Nothing

DoCmd.Close acForm, "frm1", acSaveYes
DoCmd.Close acForm, "frm2", acSaveYes

End Sub

One particular field [NCDescription] has "Enter key behavior: New line in field" toggled.

When i receive the email the text is concatenated instead of retaining the paragraphs. how would i fix this?
 
Hi. When you received the email, are you using Outlook to view it? If so, do you see an info banner/message at the top of the message saying something like: "Extra line breaks were removed..." or something along those lines?
 
Using outlook yes. There is no message about line breaks. All other formatting is correct.
 
Using outlook yes. There is no message about line breaks. All other formatting is correct.
How about an option to view the email as HTML? You may be viewing it as Plain Text?


Otherwise, the workaround is to double the line breaks.
 
at the top of the email it says Message (HTML)
 

Users who are viewing this thread

Back
Top Bottom