Email json with \n does not produce a newline in yahoo or gmail

New just trying curl POST request like:

"subject": "Test email",
    "body": "Act: disco \ntest\ntest",
    "to": [{
      "name": "Stormy",
      "email": "<omitted>"
    }]'

it is sent OK, but, no new lines in both gmail or yahoo.. Tried \\n and \\\n all are printed on one line.

If trying with \nl in a bash variable like:

BODY=”test

test”

it returns such an error:

"error":{"type":"api.invalid_request_error","message":"we could not deserialize your request, incorrect request body format"}}

Question is how to construct a curl/POST with body having html or new lines in it..

Tried Content type text/html,. but it rejects wanting only application/json… or multipart/data.

Thanks.

Hello,

Could you try the same body and also pass this parameter as true: Nylas Email, Calendar, and Contacts API docs | Docs

Thank you,

–Sam Xavier,
Support Engineer, Nylas

Can you exactly say the parameter to set to true and full syntax? that url opens to a blank page for me.

Hello!

I apologize, it seems like something got mangled within the URL:

Parameter:is_plaintext

Type:boolean

default:  
false

When true, the message body is sent as plain text and the MIME data doesn't include the HTML version of the message. When false, the message body is sent as HTML.

–Sam Xavier,
Support Engineer, Nylas

Thanks, but do u have more information on how to use it? or.. better yet, a working example?

Tried placing the is_plaintext in top, near body, and also inside the TO block:

    "body": "Reaching out using the <a href=https://www.nylas.com/products/email-api/>Nylas Email\ntest\n API</a>",              
    "is_plaintext": "True",                                                                                                      
    "to": [{                                                                                                                     
      "name": "Stormy Miller",                                                                                                   
      "email": "stormy1777@yahoo.com"                                                                                            
    }]                                                                                                                           

returns error:

{"request_id":"","error":{"type":"Internal error","message":"an internal error has occurred, please contact support if issue persists"}}

Whereas inside the “to” block, no error, but it does not add spaces/new lines.

Then it dawned on me, wait, if this is html, maybe simply using will work, so changed this line in base:

MESSAGE=“${MESSAGE//$‘\n’/< br >}”

(in above the “br” is surrounded by < > added space to avoid formatting by forum itself.

and now there are newlines, since they were replaced with html code.. appreciate if u tell how to place that parameter in the calling post..

Thanks.