# Problem form sending a document via Mail

**URL:** <https://forum.inductiveautomation.com/t/problem-form-sending-a-document-via-mail/60622>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [June 10, 2022, 2:43pm UTC](https://forum.inductiveautomation.com/t/problem-form-sending-a-document-via-mail/60622 "2022-06-10T14:43:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Etienne\_Delafolie](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@Etienne\_Delafolie](https://forum.inductiveautomation.com/u/Etienne_Delafolie)\
**Post date:** [June 10, 2022, 2:43pm UTC](https://forum.inductiveautomation.com/t/problem-form-sending-a-document-via-mail/60622/1 "2022-06-10T14:43:38Z")

</div>

Hello, My problem is the mail is send but no document

```auto
contenu = "Rapport Table Palette "
filepath = "C:\CSV\Export\\test.txt"
filename = "test.txt"
filedata = system.file.readFileAsBytes(filepath)
titre = "b"
A_qui = ["my.mail@compagnie.com"]
system.net.sendEmail(smtpProfile="MailTerreal",fromAddr="ivan.gnition@compagnie.com",to=A_qui,body=contenu,subject=titre,attachmentNames=filename,attachmentData=filedata)

```

Sorry for my bad english  
Best Regard  
Etienne DELAFOLIE

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 10, 2022, 2:46pm UTC](https://forum.inductiveautomation.com/t/problem-form-sending-a-document-via-mail/60622/2 "2022-06-10T14:46:22Z")

</div>

> [@Etienne\_Delafolie](#):
>
> `filepath = "C:\CSV\Export\\test.txt"`

You need to double your first two backslashes, I think.

(Microsoft's choice of the backslash for folder separators was just plain stupid, IMNSHO, as all major programming languages use it as an escape character for control codes. Even Microsoft's own languages.)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 10, 2022, 2:47pm UTC](https://forum.inductiveautomation.com/t/problem-form-sending-a-document-via-mail/60622/3 "2022-06-10T14:47:40Z")

</div>

> [@Etienne\_Delafolie](#):
>
> `,attachmentNames=filename,attachmentData=filedata)`

Also, I think these need to be lists. Like so:

```auto
attachmentNames=[filename],attachmentData=[filedata]

```
