Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Where does incoming email go in AS/400 and how it is handled?

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

  • Where does incoming email go in AS/400 and how it is handled?

    I try to create a system for our own use where I can handle incoming email in AS/400. Example: We have a customer who sends orders by email (order data will be in attachment files). I want to receive these in AS/400 and programmatically handle them in AS/400 (with CL and RPG programs). Questions about checking incoming mail in AS/400: A) Is this possible with QRYDST and RCVDST commands? B) If A) is not possible then how it should be done? (an example please) C) What are these exit points and exit point programs for mail? So far I'm able to SEND email from AS/400 with attachments by SNDDST command. I just found out that incoming email messages are in IFS folder and attachments are converted as part of the message. I've also searched this forum and read a lot of threads, but I haven't found an answer. Our AS/400 is in V4R4. AS/400 is not our email server. As a mail server we have a Linux box. That box redirects incoming mail to our AS/400 for the particular user that I'm using for this purpose only. TIA, Hannu

  • #2
    Where does incoming email go in AS/400 and how it is handled?

    This should be possible with QRYDST and RCVDST. I have programs on our AS400 (v4.3) that both send & receive mail however our AS400 is our mail server. This is how I did it: Create a directory entry for the mail account. Do this via WRKDIRE and use option 1 for add. 'User profile' must match a valid profile on your system. Enter the name of your AS400 in 'System name'. Leave 'System Group' blank. Mail service level = 1. Preferred address = 1. Press F19, 'SMTP user ID' = fred, 'SMTP domain' = acme.com where the acount's address is fred@acme.com. SMTP domain may need to be network name of your AS400. The mail account is then ready to receive mail. Check for mail with QRYDST. Receive mail with RCVDST. Granting yourself the authority to receive mail via the new account is hairy stuff and a topic in itself.

    Comment


    • #3
      Where does incoming email go in AS/400 and how it is handled?

      Thank you! QRYDST and RCVDST work now, but... more questions. When I run RCVDST to an outfile there is a 500 characters long field called RCVDTA in that file. The message data including attachment file data is in this field. If I have a large message or attachment file they split to several records in this file. It seems that ASCII CRs and LFs are included in this data. Question: How do you produce the original message as seen on the PC mail program screen before you sent it? Do you have somewhat complicated program to concatenate the data from different records? Other problem I found was the conversion of our special characters, but if you don't have those, so forget that. Regards, Hannu

      Comment


      • #4
        Where does incoming email go in AS/400 and how it is handled?

        I've asked this also from IBM and... They said that according our support agreement they can answer that I should use some HFS APIs (like QHFCPYSF, QHFOPNSF and QHFRDSF) and read some manuals. Also there are many other ways to solve my problem, but they didn't tell me what they were. They have also build some solutions to other customers (I think), but they are too expensive in this case they told me. Anyway, I may sound bitter, but this seems to me like building a house and somebody advices me to cut some trees for it or I can use also other materials. AS/400 may be a good computer for some purposes, but I think in some cases it lacks features it should've had for years.

        Comment


        • #5
          Where does incoming email go in AS/400 and how it is handled?

          To understand where mail goes and what you can do with it, review the AnyMail/400 Mail Server Framework Support manual in the online library. You will also want to review the AnyMail/400 Mail Server Framework APIs that are documented in the System API Reference. Please note that the above may very well provide more information than you ever really wanted to know on how mail moves through the iSeries 400.

          Comment


          • #6
            Where does incoming email go in AS/400 and how it is handled?

            Vincent, to assign permission to receive mail for the user, couldn't you just use the GRTUSRPMN command? Works for me. Let me know.

            Comment


            • #7
              Where does incoming email go in AS/400 and how it is handled?

              Glad to see I'm not the only one willing to torture myself with this stuff. Receive the thing into a document rather than into a file. This seems to take care of ASCII-AS400talk conversion. Then copy the doc into a file. The command to receive the mail into a doc may look something like: RCVDST DSTID('My distributionID') USRID(USERID ADDR) DOC(MYDOC) FLR(MYFOLDER) OUTDTATYP(*DOC) DSTIDEXN(1) The command to copy the doc into a file: CPYFRMPCD FROMFLR(MYFOLDER) TOFILE(*LIBL/MYFILE) FROMDOC(MYDOC)

              Comment


              • #8
                Where does incoming email go in AS/400 and how it is handled?

                Yes GRTUSRPMN will assign permission to receive mail. However if you receive the mail into a QDLS document (see my response to Hannu) then you will also need authority to the folder that the doc lives in. Here's how I achieved it: WRKFLR Type option 14=Authority next to your folder. Public authority ought to be *EXCLUDE for my way of thinking. Press F6=Add new users and give the user *ALL authority. I guess this isn't such a hairy topic but I ran out of time to explain it before.

                Comment


                • #9
                  Where does incoming email go in AS/400 and how it is handled?

                  Yes, I've read those manuals. I'm just a simple RPG programmer and these APIs etc. seem to me that if I'd like to create some sort of more complicated mail server application then I'd use these. So far: I've found out that messages go to IFS directory called '/QTCPTMM/MAIL/' and in there to subdirectories per mail user. This is the case when I've configured the value of 'Mail service level' = 2 (System message store) and 'Preferred address' = 3 (SMTP name) for the user in system directory. According to IBM this directory is the mailbox for POP3 mail server of AS/400. The message contains the attachment also, but I think that I can extract it from other message text. About special characters: The messages in that directory are in ASCII format except our scandinavian special chars (ÅÄÖ etc. (or whatever you can see)). I can also read these messages with a POP3 client (ie. Netscape Navigator) and there I see all chars Ok. Special chars are converted to three byte strings ie. 'Ä' (A with dots) is '=C4' when I use ASCII ISO8859, Latin 1 (code page 819). I've written a small RPG program that converts these backwards after I've copied the message file with CPYFRMSTMF command to AS/400 DB file. Hannu

                  Comment


                  • #10
                    Where does incoming email go in AS/400 and how it is handled?

                    Yes, I think that there must be quite many people who have figured this problem somehow, but for some reason there are no answers...? I tried what you suggested, but the file created contains only one record and it's just a mess (not ASCII text). CPYFRMPCD sent also a message where it was said that file in the folder isn't a PC file (message ID: IWS16BF). Then I tried CPYFRMSTMF and with that I got it nearly right. Special chars didn't convert and attachment is included in the message, but there is no indication where it begins and ends and that is what I need (or separate attachment file). I have to admit that with APIs I could get it separated from the message, but it seems to me too difficult way to manage this problem. Please look what I responded to Bruce. There I explain what I've done so far. Thanks, Hannu

                    Comment


                    • #11
                      Where does incoming email go in AS/400 and how it is handled?

                      I am now out of my depth - I do not understand why this method works fine for me but not for you. Some suggestions: Try sending the email formatted as plain text, alternately as HTML formatted text. I've found that HTML formatted mail sometimes gives unpredictable results. Examine the received document via a text editor (notepad etc). Both the mail body & the attachment should appear as plain readable text. Don't send an attachment with extention '.TXT' (eg. myfile.txt). I have found that QRYDST will not recognise attachments of such a name. Maybe somebody could tell me why? The attached file (mailrcv) is the RPGILE prog I use for receiving mail. There are a couple of CL progs called by it - you should not need them to understand the flow of the RPGILE prog. This very program is in use & happily receives many mail/attachments every day (it runs in batch).

                      Comment


                      • #12
                        Where does incoming email go in AS/400 and how it is handled?

                        The attachment (mailrcv) I tried to send in my last response didn't arrive. Here it is again.

                        Comment


                        • #13
                          Where does incoming email go in AS/400 and how it is handled?

                          Hi! Thanks for the source. I tried your suggestions, but unfortunately they didn't help. I read your program and I noticed that after you issued QRYDST command to an outfile and read that file you had a line 'IF LINDTP = 14' in the $ProcElement procedure. I found an IBM manual where it was said that document type 14 is 'IBM PC data file'. When I run QRYDST to an outfile then LINDTP field value is 2 (= 'final form text document' according that manual). If run RCVDST to a document in a folder as you do in $ReceiveToDoc procedure all I have is one long line of a mess. If I then run CPYFRMSTMF command from that document to a file in qsys.lib file system with default parameters I 'll have the message data in EBCDIC format and the attachment is in the the message. ===========================Here is the data snippet from the file: ?K?e ?J? ` Date: Fri, 20 Oct 2000 09:03:03 +0300 To: username@atoy.fi From: Hannu Jankeri ??------------------------------------------------------------------------? ??------------------------------------------------------------------------?This is the first line of the attachment file. 12345678901234567 345678,90 2nd line 54756 1780,12 3rd line 568ADDFKL 2208,33 4th line 12$45 21,00 5th line with some special chars 45ABC####34 345,00 6th line with some special chars 568AD 208,33 7th line and this is the last line of the attachment file.??------------------------------------------------------------------------? -------------------------------------------------------------------------- Atoy Oy Hannu Jankeri Tel +358 9 6827 212 Fax +358 9 6827 352 ==================================End of the data snippet. Regards, Hannu Later: One thing popped out to my mind. We don't have OV/400 in our AS. Do you have one? If so, could this be the difference between our systems?

                          Comment


                          • #14
                            Where does incoming email go in AS/400 and how it is handled?

                            No, we don't have OV/400. On our system QRYDST to an outfile produces a file with several records: - 1 record (LINDTP=2) for the mail body (includes subject line) - 1 record (LINDTP=14) per attachment. Sometimes the whole lot turns up in one single record when the mail is formatted as HTML rich text. I have no suggestions why we might differ here.

                            Comment


                            • #15
                              Where does incoming email go in AS/400 and how it is handled?

                              Many thanks! I think we're (or at last I am) banging our heads to a wall in this case. I know I can't get a good answer from IBM. So I have to think other ways to solve this problem. Thank once more for your time and effort. Hannu

                              Comment

                              Working...
                              X