# Sending Alarm text to email

**URL:** <https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750>\
**Category:** Ignition\
**Created:** [July 11, 2017, 6:49am UTC](https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750 "2017-07-11T06:49:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [July 11, 2017, 6:49am UTC](https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750/1 "2017-07-11T06:49:49Z")

</div>

Can somebody explain to me, please, why this isn’t working:

I have (test for now) tag with alarm defined with EU characters (šđčćž ŠĐČĆŽ):

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a7f7b41c0a84ce82fddef0fac910f40528e41462.PNG)

In the Tag Event/Alarm Active I have:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fc192286a3126c340358975b5c2564909190e153.PNG)

and my shared script is this:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1e6e6cdc01d84023f9d0dea943a3cf2779037fe8.PNG)

When I set alarm (tag to true) active, I get an error:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e550b0066d0dc826f908c628e61f03a85ad76ee2.PNG)

but if I remove time (today), the mail gets send OK…  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/48fa24d07bb5cf228535106a4e26736c378b9aaa.PNG)

and this is what I get in my email:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/40a11d31232844fb4c9c176cd1766a3f5b7eeac3.PNG)

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [July 11, 2017, 8:30am UTC](https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750/2 "2017-07-11T08:30:23Z")

</div>

Very strange error. The error also mentions line 10, where only the final part of the body is added. And the message itself is about being unable to parse 0x61 to utf-8, while that should be simply the lowercase “a” in utf-8… which isn’t present in that line

Could you perhaps try with %s replacements?

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [July 11, 2017, 8:37am UTC](https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750/3 "2017-07-11T08:37:56Z")

</div>

That line 10 is, in fact, line 9… the pictures get mixed up when I was trying all sort of things…

But I think I found the solution:

```auto
body += alarmName.encode("utf-8")

```

I hate encodings and Unicode and … 😡

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [July 11, 2017, 11:04am UTC](https://forum.inductiveautomation.com/t/sending-alarm-text-to-email/14750/4 "2017-07-11T11:04:39Z")

</div>

This makes more sense, as š is the first non-ASCII character of that string, on position 16.

The original encoding is probably UTF-16, as it complains about 0x61, which is part of the UTF-16 encoding of that character: 0x0161 [http://graphemica.com/š](http://graphemica.com/%C5%A1)

though it’s still strange it only mentions 0x61 and crashes on it. I’d expect that it would crash on 0x01, or give some garbled up text like usual.
