Mail from iSeries with attachment

旧巷老猫 提交于 2021-02-08 20:55:14

问题


Is there a way to send an email from an iSeries terminal, adding an attachment from the IFS? I know how to send a normal email using the SNDDST utility.


回答1:


There is two main methods of doing this.

  1. The Do-It-Yourselfer will use QtmmSendMail API
  2. Otherwise there are several other free and purchased products that you could use. The ones I would recommend are:
    • MAILTOOL - Currently $399. Depending on what you are trying to do, I would recommend SplTool Suite if you want to email out spool files.
    • RPGMail - Free API making use of JavaMail



回答2:


Recent versions of the operating system come with the SNDSMTPEMM command already included. It's quite easy to use and allows you to include both a message body and an attachment simply by populating the appropriate parameters.

That is what I would recommend for anyone who has it on their system, and needs something simple and free. For more robustness, there is Brad Stone's MAILTOOL Plus, which is available as a paid subscription.

The below information is my original answer, slightly updated, mainly for historical purposes:


Where I work we use MMAIL. It's low-cost and provides easy-to-use commands. For example, I happen to e-mail stream files all the time as follows (within a CLP):

  MMAIL/EMLSTMF SUBJECT('Monthly Sales Reports') +
    FROMNAME('AS/400') FROMADDR('as400@mycompany.com') +
    TO('jsmith@mycompany.com'/Jim Smith/*TO +
       'bjones@mycompany.com'/Bob Jones/*CC) +
    STMF(&FILE1 &FILE2 &FILE3)

There are other parameters available as well (pretty self-explanatory if you use the interactive prompt), and several other commands to handle the most common use cases. The package does also provide an API if you want finer control, or need to send much more complex messages, but I have never needed more than the provided commands.

This utility used to be free, but the author now requires a "donation" of $50 for full access to downloads from his site.




回答3:


You could code your own program with Java and the JavaMail API.




回答4:


I have not looked in a while but there should be some unixy mail utilities on i5/OS that QSH could use. If not, it's supposedly a simple matter to port one. Look here for ideas: http://www.shelldorado.com/articles/mailattachments.html

But I like the JavaMail idea better. Just a quick google yields a site that has examples of JavaMail usage: http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-javamail.html

With JavaMail you can also read mail if that could also be useful.

Update: You say you can already add attachments from the IFS. The command CATSPLF (part of QSH utilities) can retrieve spool files and write them to standard output. Which means you can transfer spool files to the IFS. But you have to know a lot about the job that created them.

Like:

    catsplf ... > /my/files/path
I found this at http://www.mcpressonline.com/tips-techniques/cl/techtip-read-printer-output-with-qshell.html. CATSPLF was introduced in V5R3.

来源:https://stackoverflow.com/questions/321199/mail-from-iseries-with-attachment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!