ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

intermittent trouble with QtmmSendMail .pdf attachments

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

  • intermittent trouble with QtmmSendMail .pdf attachments

    We're experiencing an intermittent issue where some .pdf attachments emailed to vendors (via QtmmSendMail) are incomplete. This sporadic issue seems to only happen during a nightly batch job in which multiple emails (with attachments) are being sent, and at this point, I cannot find a pattern to what is happening. Most attachments are fine, but we have received calls of an occasional one that is incomplete. When notified, I can manually call our same "sendEmail" command to email the document to the vendor and everything will be fine with the attachment.

    Has anyone ever had a similar issue or have any ideas as to what might be happening?

  • #2
    The QtmmSendMail API (which, in my opinion, is one of the most poorly designed APIs that IBM provided) works by signalling a background job to process the input stream file. So while QtmmSendMail begins the process, it will complete and return control to your program before the contents of the stream file have been fully processed. The backround/batch job will finish the processing and delete the stream file when it's done.

    Usually when people have trouble with it, it's because they reuse the same stream file for the next message. Since their program regains control before the file has been fully processed, if it makes changes to the file (such as sending another e-mail using the same file) it can cause unpredictable problems.

    That would also explain why it fails when run in yout batch process, but succeeds when you test it, since batch process is more likely to be sending multiple messages quickly, it's more likely to reuse the file before the background job is done with it.

    Of course, I haven't done troubleshooting on your particular software, so I could be off-base. This is purely based on what I've seen with other QtmmSendMail software. I would suggest, if possible to stop using QtmmSendMail and use a better alternative.

    Comment


    • TeresaH
      TeresaH commented
      Editing a comment
      Scott, sorry for the delayed response, but I had no authority on the site to do so (thanks Jamie for fixing things).

      Anyway, just an FYI, I looked into our software and the filename is a combination of a prefix + jobNbr + timestamp.

      Thanks for explaining the shortcomings of the API. Care to share your thoughts on "a better alternative"?

  • #3
    I wrote articles on how to replace QtmmSendMail with my own programs that communicate via SMTP, which is the internet standard for that sort of thing, so works with the IBM i's e-mail system, but also works with others (such as an Exchange server on your network, a Linux box that routes mail, or an ISP-provided mail server.) I thought that was a better way to do things, but unfortunately these articles are no longer available as the company that published them decided to exit the IBM i market.

    But, that assumes that you want to do all the e-mail work yourself. (Like you would if you coded QtmmSendMail)

    There are quite a few tools out there, pre-written, that do e-mail, many of them are free.

    Unfortunately, this is all based on research that I did 10 years ago, and I don't remember the details anymore. I'd suggest trying to Google IBM i e-mail tools and see what you can find. If you want to try the ones that I published, I could try to find them, too... let me know.

    Comment

    Working...
    X