ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

using QtmmSendMail in RPG Program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • using QtmmSendMail in RPG Program

    Merry Christmas All, thanks in advance for your help.

    I am trying to use QtmmSendMail in an RPG program. The emails are not being sent.

    The QMSF joblog shows: Message ID : TCP9676, Cause . . . . . : SMTP message forwarding was stopped because bad data was detected in NO EOH CRLFCRLF.

    I am building a physical file in the rpg program then copying to the IFS using CPYTOIMPF: CPYTOIMPF FROMFILE(EMAIL) TOSTMF('/temp/mimefile.txt') MBROPT(*REPLACE) STMFCODPAG(*PCASCII) RCDDLM(*CRLF) DTAFMT(*FIXED)

    The IFS file looks like this:
    From: "Me" <john@john.com>
    To: "You" <john@john.com>
    Subject: HTML Based Email from the iSeries
    Date: 12/17/2020
    Mime-Version: 1.0
    Content-Type: Text/HTML; charset=US-ASCII
    CRLF
    <HTML><BODY>
    <table><tr><TD A HREF="http://www.as400.ibm.com">
    <img src="http://www-1.ibm.com/servers/eserver/iseries/hardware/graphics/
    iseries_family.jpg">
    </td><td><FONT SIZE=5>
    HTML formatted Email <br>from the iSeries
    </font></td></tr></table><br>
    <TABLE BORDER><TR>
    <TD BGCOLOR="#00ffff" align="center">ORDER NUMBER</TD>
    <TD BGCOLOR="#00ffff" align="center">CUSTOMER</TD>
    <TD BGCOLOR="#00ffff" align="center">SHIP DATE</TD>
    <TD BGCOLOR="#00ffff" align="center">ORDER VALUE</TD>
    </TR>
    <TR><TD ALIGN="Left">M465043</TD>
    <TD ALIGN="Left">Roys Sandwich Shoppe</TD>
    <TD ALIGN="Right">03/15/2004</TD>
    <TD ALIGN="Right">1,245.55</TD></TR>
    <TR><TD ALIGN="Left">M464657</TD>
    <TD ALIGN="Left">That Sub Place</TD>
    <TD ALIGN="Right">03/19/2004</TD>
    <TD ALIGN="Right">1,455.85</TD></TR>
    <TR><TD ALIGN="Left">M557890</TD>
    <TD ALIGN="Left">Harrys House of Hoagies</TD>
    <TD ALIGN="Right">03/22/2004</TD>
    <TD ALIGN="Right">6,685.55</TD></TR>
    </TABLE>
    <P>END OF REPORT
    </body></HTML>

    From what I understand, the CRLF between the header and body should be on a line all by itself. It looks like it is to me. I have tried both CRLF and CRLFCRLF. Anyone see what I'm missing?

  • #2
    It has been many many moons since I used these APIs directly and I can't see anything obviously wrong. I would however suggest that you go to easy400.net and download the MMAIL utility - it will make you life much easier.

    Comment


    • #3
      Thanks JonBoy, I've used that before. I'm hoping to get this to work, auditors tend to get in the way at times.

      Comment


      • #4
        I'm looking at this part of your data:
        Code:
        Content-Type: Text/HTML; charset=US-ASCII
        CRLF
        <HTML><BODY>
        That middle line. Does it actually contain the letters C, R, L and F? Or is that your way of telling us that the unprintable carriage return (CR) and line feed (LF) characters are there?

        There actually should be CR and LF characters (NOT the letters C,R,L and F) at the end of ALL lines, not just that one. That one should just be an empty line -- in other words it contains nothing else aside from the CRLF, whereas all the other lines contain data followed by CRLF. Does that make sense?

        Also, how is the data encoded? Keep in mind that it must be encoded in ASCII (Not EBCDIC!)

        It seems strange to me that you'd use CPYTOIMPF, here. I must admit, I rarely use this command, and I'd never use it for something like this where the data isn't coming from an externally defined database table. Are you sure that this command will give you precise enough control over the data written to the stream file?

        Comment


        • #5
          That's my way of showing the CRLF should be there, here are the readable values:
          Content-Type: Text/HTML; charset=US-ASCII

          <HTML><BODY>


          Doesn't the *PCASCII ensure the IFS file is encoded ASCII? Do you suggest writing directly to the IFS rather than using CPYTOIMPF?


          Comment


          • #6
            This is just a guess, but I interpret the part of the error message that says "NO EOH CRLFCRLF" as perhaps meaning that there needs to be 2 blank lines between the header and body.

            Comment


            • #7
              Thanks Brian, tried that. Same results.

              Comment


              • #8
                Look at the stream file in hex, see if the values are correct.

                Comment

                Working...
                X