Page 1 of 1

trouble with returns in windows cURL

Posted: Thu Nov 30, 2023 4:47 pm
by adventuresofgreg
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?

Re: trouble with returns in windows cURL

Posted: Thu Nov 30, 2023 7:34 pm
by adventuresofgreg
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.

Re: trouble with returns in windows cURL

Posted: Thu Nov 30, 2023 7:46 pm
by matthiasr
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.