Email probleme "invalid body"

Hello!

I´m using the script below to Forward SMS to email. If the SMS has only one row, everthing works like a charme. When the SMS has more then one row, the sendingprocedure fails and I get an error “invalid Body” ind log. Any Ideas?

:local EmailAddress “xxxx.yyyy@zzz.at”;
:local smsPhone;
:local smsTimeStamp;
:local smsMessage;
:local smsContent;

Get System Identity

:local SystemID [/system identity get name];

:log info “SMS to Email script started”;

Set Receive Enabled, in case it was cleared by a router reboot

/tool sms set receive-enabled=yes;

delay 1;

/tool sms set port=lte1

delay 1;

loop through all the messages in the inbox

:foreach i in=[/tool sms inbox find] do={

:set smsPhone [/tool sms inbox get $i phone];
:set smsTimeStamp [/tool sms inbox get $i timestamp];
:set smsMessage [/tool sms inbox get $i message];

:set smsContent “$SystemID _SMS Received from: $smsPhone_Date&Time: $smsTimeStamp _Message: $smsMessage”;

:log info $smsContent;

/tool e-mail send start-tls=yes subject=“$SystemID GSM Modem SMS Received” to=$EmailAddress body=“$smsContent”;

Now remove the SMS from the inbox

/tool sms inbox remove $i;

delay 5;

}

:log info “SMS to Email script complete”


Kind regards

could it be that the problem has something to do with the \n or \r\n differences in linebreaks?
only a suggestion :wink:

Hello!

Yes, when the SMS has no linebreak, everything works. With a linebreak it fails. And some SMS I receive has some linebreaks.
So I´ve no idea what the problem is.

maybe I have mispronounced myself, I mean it might be related to the fact that there are different encodings for line breaks.
have you checked what encoding is used in sms?

unix world uses \n (chr 13) only, windows world is using \r\n (chr 10, chr 13)