Send a Mime Mail

page d'accueil
Boite à outils

Cette page a été mise à jour le 14 septembre 2009
Contact

Welcome page
Tools box

Versionning 

last version : How to upload to my 400

CHGPFM FILE(JPLTOOLS) MBR(MAIL) SRCTYPE(CMD) EXPDATE(*NONE) SHARE(*NO) TEXT('send a mime mail') 
CHGPFM FILE(JPLTOOLS) MBR(MAILR) SRCTYPE(SQLRPGLE) EXPDATE(*NONE) SHARE(*NO) TEXT('send a mail')
CRTCMD CMD(MAIL) PGM(MAILR) SRCFILE(JPLTOOLS) SRCMBR(MAIL)
CRTSQLRPGI OBJ(MAILR) SRCFILE(JPLTOOLS) COMMIT(*NONE) OBJTYPE(*MODULE) OPTION(*NOSEQSRC *XREF *SECLVL) CLOSQLCSR(*ENDMOD) REPLACE(*YES) SQLPATH(*LIBL) DBGVIEW(*SOURCE) USRPRF(*USER)
CRTPGM PGM(MAILR) ACTGRP(jpltools) bnddir(qc2le) BNDSRVPGM(QTCP/QTMMSNDM)

This tool based on the api TMMSENDMAIL (a procedure from QTCP/QTMMSNDM) implements main rfc822 & rfc1521 recommendations. It can send many documents attached and a body in text or html format to many receivers. It's not JavaMail, it's pure native code. If it's your target, you can find an implementation of javaMail at Java From Rpg


MAIL SUBJECT('a new mail tool') SENDER(*me) RECEIVER((*TO 'you@company.com') (*CC 'you@company.com') (*BCC 'you@company.com')) MESSAGE('<html><body><h3>Hello,<br>How are you ?</h3></body></html>') MSGTYPE('text/html') ATTACH((*BIN *ATTACHED 'image/jpeg' '/jpl/jpl.bmp'))

mail builds a temporary IFS file that is sent to recipient by the API. I have located this file with the data area MAIL

You need to run one time these two commands:


CRTDIR DIR('/Mail') RSTDRNMUNL(*NO)

CRTDTAARA DTAARA(JPLTOOLS/MAIL)
TYPE(*CHAR)
LEN(100)
VALUE('/Mail')
TEXT('Mail temporary files root')

qtmmsendmail is an interface to QMSF  (the Mail Service Framework of the 400). If SNDDST already works on your 400, then you don't need more configuration. If no, have a look at http://jplamontre.free.fr/AS400/SolvingEmailProblem.htm or http://iseries.pentontech.com/t?ctl=35231:11FF94

The source code is provided as an open source tool under the GNU General Public License, version 2.  In summary, this license specifies:

By clicking the download link you acknowledge and agree to the terms of the license.

Download the (zipped) SAVF containing the JPLTOOLS : the source file, the message file, the bnddir

THIS TOOLBOX IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROVIDER OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS TOOLBOX, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.