trouble with returns in windows cURL

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

trouble with returns in windows cURL

Post by adventuresofgreg » Thu Nov 30, 2023 4:47 pm

I'm able to send the following field as cURL through an email api and it works from a Mac standalone, and a slightly reformated version below also works from a windows standalone. However, only the first line of [[body]] is sent, and everything after the 1st return is ignored. If I replace my returns with "" in [[body]] then it is sent OK. I've tried replacing returns with CR and CRLF and LF and nothing works. I've even tried textencode()

curl -s --user "api:apikey" https://api.mailgun.net/v3/.../messages -F "from=[[emailfrom]]" -F "to=[[tUserName]]" -F "subject='[[emailSubject]]'" -F "text='[[emailbody]]'"

Any ideas?

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: trouble with returns in windows cURL

Post by adventuresofgreg » Thu Nov 30, 2023 7:34 pm

It's ok. Figured it out. You cant have returns in cURL in windows, so you need to fornat as HTML using <br> for returns and then send the email as html rather than text.

matthiasr
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 190
Joined: Sat Apr 08, 2006 7:55 am
Location: Lübbecke, Germany
Contact:

Re: trouble with returns in windows cURL

Post by matthiasr » Thu Nov 30, 2023 7:46 pm

You cant have returns in cURL in windows
Hm, is it possible that mailgun expects the returns as LF? I am wondering if using LF as line delimiter in the text and saving the file as binary to hard disk (URL "binfile:....) and then using the path to that file as input for the text would allow plain text.

Code: Select all

curl -s --user "api:apikey" https://api.mailgun.net/v3/.../messages -F "from=[[emailfrom]]" -F "to=[[tUserName]]" -F "subject='[[emailSubject]]'" -F "text='[[emailbody]]'"
[[emailbody]] would then be replaced by

Code: Select all

URL "binfile:<Path to your textfile>
" This way the line delimiter LF is kept.

Post Reply

Return to “Talking LiveCode”