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:
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)
ecujak
March 13, 2012, 8:40pm
2
I was about to attempt the same. So I am interested in this answer as well.
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
ecujak
March 13, 2012, 8:44pm
4
recipients = [“bobsmith@mycompany.com”, "1235558383@vtext.com ", "sally@acme.org ", "1235557272@vtext.com "]
so you say this would work instead?
destStr = ["2176175502@email.uscc.net"]
ecujak
March 13, 2012, 8:57pm
6
Thank you Travis… now can you help me with my last post
Now I’m getting a different error. But that address works from my regular email client.
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:
system.net.sendEmail("iaexch",fromStr,subjectStr,bodyStr,0,destList)
I think the important part here is:
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.