ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

send email - QtmmSendMail

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

  • send email - QtmmSendMail

    This is "kinda" cool its taken from an example by Scott Klement

    I modified to read a table we all have QSYS2/sysviews

    as it reads the table it creates an email, then at the end it emails

    out to the address supplied.

    here is the email


    I attached the program and two copy books.


    Let me know what you think.
    As always if anyone has the time it would be nice
    if someone could take the time and make this
    parameter driven....


    thanks

    jamie
    Attached Files
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  • #2
    Re: send email - QtmmSendMail

    Hi Jamie,

    I am playing with the code you supplied here to send an HTML email using the QtmmSendMail API. I have created the program as provided and changed to my email addresses etc. I ran the program the first time and voila I got an email, very cool.

    Now the fun begins, the QMSF jobs choked as they did not have authority to delete the IFS file in '/tmp' used to store the email contents. After I changed the owner on the IFS file in '/tmp' to be user QMSF with the authority (*RWX & *ALL) and restarted QMSF (STRMSF) it worked again.

    Did you run into the same problem? I am trying to figure out if I can add this explicit authority when I create the IFS File or if I have to have a separate CL CHGOWN & CHGAUT for this purpose.

    Should I perhaps submit the job that generates the tmp file and email using the QMSF profile?

    Any insight or prodding with a sharp stick would be appreciated.

    Thanks,

    Rayden.
    "This hangover is a bad one".

    "So you gonna quit drinking?".

    "Nah, I'm gonna quit waking up!".

    Charlie - Two and a Half Men.

    Comment


    • #3
      Re: send email - QtmmSendMail

      Sorry busy day!

      try this for your create -- where are you in Chicago?
      did I ask this before?



      PHP Code:
      MD DIR('/home/MyFolder'DTAAUT(*RWXOBJAUT(*ALL
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: send email - QtmmSendMail

        Hi Jamie,

        Simple ideas really work

        I was using the pre-existing '/tmp' folder on the IFS which was not created in this fashion. I should have just created a new one specifically for this application and it would have had no authority issues. For now the job that uses the QtmmSendMail command is submitted to run under QMSF profile and that works fine. When I make the finall tweaks I will create its own folder to work with and alleviate all the problems.

        Thanks for the pointers.

        As for where, I work for a Company based out of Wood Dale in the transportation/logistics business. How about yourself?

        Cheers,

        Rayden.
        "This hangover is a bad one".

        "So you gonna quit drinking?".

        "Nah, I'm gonna quit waking up!".

        Charlie - Two and a Half Men.

        Comment


        • #5
          Re: send email - QtmmSendMail

          if you can post a finished example...no company secrets please


          im in rockford Illinois bout 1 hour away.
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: send email - QtmmSendMail

            Hi Jamie,

            When(IF) I get this finished I will post the version of my code and the processing concepts I am using.

            Cheers,

            Rayden.
            "This hangover is a bad one".

            "So you gonna quit drinking?".

            "Nah, I'm gonna quit waking up!".

            Charlie - Two and a Half Men.

            Comment


            • #7
              Re: send email - QtmmSendMail

              Hi there,

              This post has really helped in getting me started with QtmmSendMail.

              I've just got one issue, I can't send a html txt file over a certain size/length, is this a limitation of QtmmSendMail?

              Also is there a way that I can use the API to send html mail from a buffer or userspace, instead of using the IFS?

              Cheers
              Rich

              Comment


              • #8
                Re: send email - QtmmSendMail

                what happens......is there an error message? can you post some?

                the API QtmmSendMail requires the sending file tobe on the IFS

                Please take a look here also


                follow links to smtp problems..


                le us know
                jamie
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: send email - QtmmSendMail

                  Thanks for the reply, I think the issue was something to do with my header set up when I edited the code, all sorted now.

                  Comment


                  • #10
                    Re: send email - QtmmSendMail

                    Originally posted by jamief View Post
                    This is "kinda" cool its taken from an example by Scott Klement

                    I modified to read a table we all have QSYS2/sysviews

                    as it reads the table it creates an email, then at the end it emails

                    out to the address supplied.

                    here is the email


                    I attached the program and two copy books.


                    Let me know what you think.
                    As always if anyone has the time it would be nice
                    if someone could take the time and make this
                    parameter driven....


                    thanks

                    jamie

                    Hey Jamie,

                    i saw your code and test it, very good job !
                    But when i change the code so that only an existing file will
                    be send, i became TCP9676 in job qmsf, because i had no header
                    that ends with CRLF.
                    i only want to send f.e. an existing pdf-file.

                    How can i solve the problem ?
                    And how can i create and place a header when call
                    API QtmmSendMail ?
                    Or must i change the existing pdf-file and modify it with an header ???

                    Hope you can help !

                    Thanks in Advance !
                    Peetluka
                    Once there was a river, now there's a Stone !

                    Comment


                    • #11
                      Re: send email - QtmmSendMail

                      not sure....I have written a module using the above example as well as the CVT2CMD program(s) supplied on the site and I am able to email just about
                      anything.....

                      Please post your code and an example of the PDF and I will give a try from
                      here.

                      jamie
                      All my answers were extracted from the "Big Dummy's Guide to the As400"
                      and I take no responsibility for any of them.

                      www.code400.com

                      Comment


                      • #12
                        Re: send email - QtmmSendMail

                        Originally posted by jamief View Post
                        not sure....I have written a module using the above example as well as the CVT2CMD program(s) supplied on the site and I am able to email just about
                        anything.....

                        Please post your code and an example of the PDF and I will give a try from
                        here.

                        jamie
                        Jamief, thanks for reply.
                        i think i've detected the error, it in my head
                        i have to write a file, that the api reads and do what in this file is
                        coded.

                        There had to be a header, a body and for attachment
                        some code like
                        content-type: "multipart/mixed"
                        Content-Disposition: attachment;'
                        + ' filename="' + attname + '"' + CRLF

                        and then, i think, it works.
                        I'll test it with the examples from scott klement.
                        if i can't solve the "problem ", i came back and ask for
                        your Knowledge !

                        Thanks again !
                        Peetluka
                        Once there was a river, now there's a Stone !

                        Comment


                        • #13
                          Re: send email - QtmmSendMail

                          Originally posted by jamief View Post
                          not sure....I have written a module using the above example as well as the CVT2CMD program(s) supplied on the site and I am able to email just about
                          anything.....

                          Please post your code and an example of the PDF and I will give a try from
                          here.

                          jamie

                          But on the other side, why not, perhaps i thought wrong ?

                          Here is the rpg: (see attachment 1)

                          and here one of the pdf, i've create from a spoolf with cvt2pdf !
                          (see attachment 2)

                          Please tell me, must i code an file with headerand body, wether i
                          only want to send an attachment without any text ?


                          Thanks again, i'm hope you answer !
                          Peetluka
                          Attached Files
                          Once there was a river, now there's a Stone !

                          Comment


                          • #14
                            Re: send email - QtmmSendMail

                            Hey Jamie,

                            I'm trying to play with this send mail stuff. I downloaded your code, created my source members and then tried to compile. I got a compile message saying...

                            Code:
                            Message . . . . :   Definition not found for symbol 'QtmmSendMail'.            
                            Cause . . . . . :   No definition was found for reference QtmmSendMail in      
                              *MODULE object CSMAIL in library QTEMP. The definition either does not exist 
                              or is not of the same data or procedure type as the reference. Recovery  . . 
                              . :   Try the Create Program (CRTPGM) command again, supplying an object     
                              that contains a definition for symbol QtmmSendMail.
                            What could I be missing that would not let me see QtmmSendMail? There isn't anything missing from your code right? Just a little confused
                            Your future President
                            Bryce

                            ---------------------------------------------
                            http://www.bravobryce.com

                            Comment


                            • #15
                              Re: send email - QtmmSendMail

                              Bryce,
                              Have you correctly compiled the program using BNDSRVPGM(QTCP/QTMMSNDM) on the CRTPGM command ?
                              Philippe

                              Comment

                              Working...
                              X