# Sending Text Message Through Email

**URL:** <https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143>\
**Category:** Ignition\
**Created:** [March 13, 2012, 8:25pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143 "2012-03-13T20:25:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [March 13, 2012, 8:25pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/1 "2012-03-13T20:25:15Z")

</div>

I want to send a text message through a wireless carrier. Their form is:

[phone number]@email.uscc.net

However, if I start the address with a number I get the following error:

java.lang.ClassCastException: Cannot coerce value '2176175502@email.uscc.net’ into type: class [Ljava.lang.String;

I can use a regular email address with no problem. is there a way around this? Here’s the script:

```auto
def NotifyKurt(strMessage):	
	import system
	fromStr = "IgnitionExtrusionMonitor@hennigesautomotive.com"
	subjectStr = "Notification"	
	destStr = '2176175502@email.uscc.net'
	bodyStr = strMessage 
	system.net.sendEmail("iaexch",fromStr,subjectStr,bodyStr,0,destStr)
```

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [March 13, 2012, 8:40pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/2 "2012-03-13T20:40:29Z")

</div>

I was about to attempt the same. So I am interested in this answer as well.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 13, 2012, 8:42pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/3 "2012-03-13T20:42:13Z")

</div>

The system.net.sendEmail function takes a list of email addresses:`def NotifyKurt(strMessage):   
   import system
   fromStr = "IgnitionExtrusionMonitor@hennigesautomotive.com"
   subjectStr = "Notification"   
   destList = ['2176175502@email.uscc.net']
   bodyStr = strMessage 
   system.net.sendEmail("iaexch",fromStr,subjectStr,bodyStr,0,destList)`Take a look at the documentation for the function here:

[http://www.inductiveautomation.com/support/usermanuals/ignition/system\_net\_sendemail.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/system_net_sendemail.htm)

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [March 13, 2012, 8:44pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/4 "2012-03-13T20:44:47Z")

</div>

recipients = [“bobsmith@mycompany.com”, "1235558383@vtext.com", "sally@acme.org", "1235557272@vtext.com"]

so you say this would work instead?

```auto
destStr = ["2176175502@email.uscc.net"]
```

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 13, 2012, 8:53pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/5 "2012-03-13T20:53:50Z")

</div>

Yes

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [March 13, 2012, 8:57pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/6 "2012-03-13T20:57:31Z")

</div>

Thank you Travis… now can you help me with my last post ![8)](https://us1.discourse-cdn.com/inductiveautomation/original/1X/587d7fe0d6822f36e81815ab06aa7164e9d2e057.gif "Cool")

---

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [March 14, 2012, 1:41pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/7 "2012-03-14T13:41:53Z")

</div>

Now I’m getting a different error. But that address works from my regular email client.

```auto
Traceback (innermost last):

  File "<script playground>", line 1, in ?

  File "<module:Notify>", line 7, in NotifyKurt

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Error sending email.

Caused by: javax.mail.SendFailedException: Invalid Addresses;

  nested exception is:

	com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for 2176175502@email.uscc.net
```

Line 7 is the last with:

```auto
system.net.sendEmail("iaexch",fromStr,subjectStr,bodyStr,0,destList)
```

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [March 14, 2012, 2:07pm UTC](https://forum.inductiveautomation.com/t/sending-text-message-through-email/4143/8 "2012-03-14T14:07:48Z")

</div>

I think the important part here is:

```auto
550 5.7.1 Unable to relay for 2176175502@email.uscc.net
```

The problem at this point is either the mail server your routing through or how you have the connection defined in the notification profile.

Normally 5.7.1 means that the mail server isn’t setup to relay the message, or it was blocked by a spam filter on its way out.
