Jim,
That makes totals sense.  Somewhere in the memory space allocated to "body",
trailing your actual data, there was garbage causing your issue.  It just
shows, once again, just how important %Trim can be to success.  I think I
use that BIF almost as much as any other, for just the same kinds of
reasons.
Glad it all worked out.
Steve M.
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jim
Hawkins
Sent: Monday, February 14, 2022 07:46
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Email from Power systems
A month or two back, there was some discussion about issues sending email
from a power system.  We have been doing this for some time, but a year ago
we converted from an inhouse mail server to using the cloud 365 email server
and many of our emails stopped arriving at the destination with a bounce
back error code of 500 indicating that a text line was longer than allowed.
One of my predecessors wrote a program called procedure that we use for
sending emails. The heart of this procedure has the following code:
               header =      'From: ' + fromName + ' <' + fromAddr + '>' +
CRLF
               +'To: '   + toName   + ' <' + toAddr   + '>' + CRLF
               +'Date: ' + MailDate() + CRLF
               +'Subject: ' + subject + CRLF
               +'MIME-Version: 1.0' + CRLF
               +'Content-Type: text/html' + CRLF
               + CRLF;
              callp write(fd: %addr(header)+2: %len(header));
         //d02callp write(fd: %addr(body)+2: %len(body));
              callp write(fd: %addr(body)+2: %len(%trim(body))); //a02
              callp close(fd);
              //
---------------------------------------------------------------------
              // Send the e-mail
              //
---------------------------------------------------------------------
              fromLen = %len(%trim(fromAddr));
              namelen = %len(%trim(filename));
              sendmail(filename:namelen: fromAddr:fromLen:
                %addr(RecipTbl):NbrRecips:ErrorCode);
About 2 weeks ago I deleted a line of this code (leading  //d02 indicator)
and added a new line of code (trailing //a02 indicator).  This appears to
have resolved the issue we were having.
Hoping that this might help someone else.
Before someone asks: I think the entire code was from was "borrowed" from an
online source, but there is nothing in the documentation indicating where,
as such, I am not willing to share the entire code set.
Regards,
Jim Hawkins
Programmer Analyst
Interkal LLC
Kalamazoo, MI
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: 
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.