# Trying to get to mailgun with FM17 cURL calls

**URL:** <https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196>\
**Category:** Questions\
**Tags:** integration\
**Created:** [August 1, 2020, 3:44am UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196 "2020-08-01T03:44:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobino](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bobino/32/194_2.png) [@Bobino](https://the.fmsoup.org/u/Bobino)\
**Post date:** [August 1, 2020, 3:44am UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/1 "2020-08-01T03:44:57Z")

</div>

Anyone got an integration going with Mailgun using FileMaker native cURL calls? I got something working in postman and in paw, I've tried many things including doing a base64encode of "api:". I'm still getting nowhere. Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![skywillmott](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@skywillmott](https://the.fmsoup.org/u/skywillmott)\
**Post date:** [August 1, 2020, 11:47am UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/2 "2020-08-01T11:47:21Z")

</div>

Aha - I've just come here after being in Slack where I saw same question 🙂 My comment there was:

This is a sample cURL options calc that works for me with Mailgun… note ‘special’ character used in front of the $emailHTML variable. I also substitute all pilcrows (¶) in the $emailHTML variable with Char(10)…

```
"-X POST
--user \"api:key-1234567890XYZ0987654321\"
-F \"from=" & $fromEmailAddress & "\"
-F \"h:Reply-To=" & $replyToEmailAddress & "\"
-F \"to=" & $recipientEmailAddress & "\"
-F \"subject=" & $emailSubject & "\"
-F \"html=<$emailHTML\"
-F \"text=" & $emailText & "\"
-F \"attachment=@$myfile;filename=" & $myfilename & "\"
"
```

---

<div class="post-metadata">

**Author:** ![Bobino](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bobino/32/194_2.png) [@Bobino](https://the.fmsoup.org/u/Bobino)\
**Post date:** [August 1, 2020, 7:45pm UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/3 "2020-08-01T19:45:34Z")

</div>

@skywillmott Thank you so much! Your post allowed me to see where I had made multiple mistakes.

Also, would you mind sharing with us about the `<` character in front `$emailHTML`. I'm glad you mentioned it, because I do not see that documented elsewhere.

Is there a fancy explication for it?

---

<div class="post-metadata">

**Author:** ![skywillmott](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@skywillmott](https://the.fmsoup.org/u/skywillmott)\
**Post date:** [August 1, 2020, 8:01pm UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/4 "2020-08-01T20:01:24Z")

</div>

Glad it helped 🙂

The ‘\>’ symbol when used in cURL indicates to send the ‘content’ of a file rather than the file itself, which is where the ‘@‘ symbol is normally used. Of course, in FileMaker cURL options, the @ symbol is also used to send a POST/PUT/PATCH etc data body (using the -d cURL option) using a FileMaker variable, such as '-d @$json’…

It is a subtle difference that works here for the -F cURL option… so the HTML you have stored in a variable such as $html is sort of ‘fed into’ the -F option rather than being ‘attached’ to it in the way a file input would work. I suppose it is something a little similar to using a textarea input in a regular HTML form.

I found all this out after lots of failed attempts to send HTML using Mailgun's API (particularly when it was multi-line, and more complex than the very basic HTML example shown in the Mailgun API docs), and eventually found this web page that had the answer: [Sending HTML to Mailgun with cURL | Jonathan Palardy's Blog](https://blog.jpalardy.com/posts/sending-html-to-mailgun-with-curl/)

---

<div class="post-metadata">

**Author:** ![Bobino](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bobino/32/194_2.png) [@Bobino](https://the.fmsoup.org/u/Bobino)\
**Post date:** [August 1, 2020, 8:03pm UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/5 "2020-08-01T20:03:37Z")

</div>

Wow! Thanks for sharing the fruits of all your hard work @skywillmott!

---

<div class="post-metadata">

**Author:** ![hebm](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@hebm](https://the.fmsoup.org/u/hebm)\
**Post date:** [February 19, 2025, 9:16pm UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/6 "2025-02-19T21:16:04Z")

</div>

> [@skywillmott](#):
>
> -F "attachment=@$myfile;filename=" & $myfilename & ""

1. Thank you I'am almost there 🙂
2. Now the "reference" to the attacment is sent but its not arriving the file,

What is the format of the "path to file" ? I am in macOS and I am using :

/hardDriveName/myUserName/Desktop/file.pdf (does not even send the file)

/myUserName/Desktop/file.pdf ( a ghost file arrives without the contents )

I know its an old thread but I'll appreciate any clue.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/5/572f642640b6772957db721e284d406e3d8137ac.png)

---

<div class="post-metadata">

**Author:** ![hebm](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@hebm](https://the.fmsoup.org/u/hebm)\
**Post date:** [February 19, 2025, 10:24pm UTC](https://the.fmsoup.org/t/trying-to-get-to-mailgun-with-fm17-curl-calls/1196/7 "2025-02-19T22:24:37Z")

</div>

> [@skywillmott](#):
>
> `$myfile`

I just found the answer myself : $myfile its a variable with the contents of the file "and" $$path its just "thenameofthefile"
