Frequently Asked Questions (FAQ)

Following are some of the frequently asked questions about MAILTOOL. When reporting problems, please send them via email stating the problem. Let me know what version of MAILTOOL you are using. See the main FAQ for instructions on finding the version you currently have installed.

  • I executed the MAILTOOL command but no email was sent. What did I do wrong?

    To use MAILTOOL you need to first make sure that you have your AS/400 set up to send emails (see FAQ on setting this up). If you know email is working (for example, the SNDDST command works), double check that you are using the correct FROM email address. Some systems that use a mail router do not allow "forwarding" from their own domain. So, you need to make sure that you are using the FROM name specified as name@host.domain. The host and domain values can be found in CFGTCP option 12.

    If this is not the problem and you have specified that you are using a mail router on the CHGSMTPA command, make sure that the FIREWALL parameter on the CHGSMTPA command is set to *YES. This normally causes a problem where email will be sent interally just fine, but emails will not reach recipients outside of your network.
    If you do need to make this change, it will not take affect until you stop then restart your SMTP server.

    Finally, don't forget to double check that SMTP and MSF are running on your machine. Also check the job logs of these services for any possible errors.

    Use the commands:
    WRKACTJOB JOB(QTSMT*)
    WRKACTJOB JOB(QMSF)

    If they are not, they can be started using the following: STRTCPSVR *SMTP Or STRMSF If they are running, test the IBM SMTP server using the SNDDST *LMSG command. If this doesn't work the issue could be with the IBM SMTP server and you should check the job logs of these jobs for any clues.

    If you have a recent version of MAILTOOL installed, contact us and we can help you to run a trace using MAILTOOL Plus.

    If all else fails, contact your mail router administrator to see if they can trace the emails to see if they are even making it to the mail router. You can also run a trace on your AS/400 to see what is going on with the SMTP server by following the instructions at this IBM site.

  • I use a job CCSID that is not 37 or when I change my jobs CCSID to something other than 37 MAILTOOL fails to send emails. Why?

    When you are using the MAILTOOL command and you change your job's CCSID, you also need to make sure to change the CCSID of the terminal emulator you are using to the same CCSID as your job. If not, in some cases the translation for the @ character in an email address will be invalid and cause errors.

  • How do you force a new line or a paragraph using MAILTOOL and the Message Parameter?

    Using the \n character sequence will force a new line, so using two of them can also force a new paragraph. This only applys to text that is entered on the message parameter of the MAILTOOL command.

  • When I send an email, my attachment is split up into more than one file and is currupted. How do I fix this?

    For pre V4R3, create a data area QUSRSYS/QTMSNOSPLT. This will turn off message splitting. In V4R4 and up, the CHGPOPA command supports a *NOMAX value for the MSGSPLIT parameter. Once you have made this change, stop and restart your SMTP server.

  • When I send an email to AOL or other accounts the email is rejected. Why is this?

    AOL and other ISPs are now requiring reverse DNS entries to accept email. If you're using MAILTOOL and/or MAILTOOL Plus! and you're not using a mail router, this is most likely the issue. If you are running MAILTOOL Plus! you can specify DEBUG(*YES) on the MAILTOOL command. This will create a file named /tmp/mailtoolsmtp.txt that will show the communications trace and any errors you are getting.

    If it is a reverse DNS issue, you can fix it by either specifying a mail router on the command or setting up reverse DNS. Here are some informational links on the subject:

    AOL Reverse DNS
    Reverse DNS Explained

  • Is it possible to call MAILTOOL from an RPG program?

    Yes, this is done using the QCMDEXC API. Following is a small example of how this can be done:

    D Subject         S           1024
    D Message         S           2048
    D ToAddr          S            128
    D FromAddr        S            128
    D QCmdCmd         S          32702    INZ
    D QCmdLength      S             15  5 INZ(%size(QCmdCmd))
    
    C                   eval      Subject ='This is the subject'
    C                   eval      Message = 'This is the message'
    C                   eval      ToAddr = 'someone@somewhere.com'
    C                   eval      FromAddr = 'me@myhome.com'
     *
    C                   eval      QCmdCmd = 'MAILTOOL ' +
    C                                       'TOADDR(''' +
    C                                       %trim(ToAddr) +
    C                                       ''') ' + 
    C                                       'FROMADDR(''' +
    C                                       %trim(FromAddr) + 
    C                                       ''') ' +
    C                                       'SUBJECT(''' +
    C                                       %trim(subject) + ''') ' +
    C                                       'MESSAGE(''' +
    C                                       %trim(message) +
    C                                       ''') '
     *
     * If you're using MAILTOOL Plus you can also add the following:
    C*                                      'SENDWITH(*MAILTOOL) ' +
    C*                                      'MAILRTR(''your.mail.router'') ' +
    C*                                      'USERTR(*ONLY)'
     *
    C                   CALL      'QCMDEXC'                            99
    C                   PARM                    QCmdCmd
    C                   PARM                    QCmdLength

  • Where can I find information on setting up my AS/400 as a mail server so that I can use the MAILTOOL command?

    IBM has some information that may help and it can be found by clicking here.

    Also, if you don't want the hassle of setting up the IBM SMTP server, you can try the MAILTOOL Plus! addon by simply requesting a key from me. The MAILTOOL Plus! Addon allows you to completely bypass the IBM SMTP server and send mail directly to your mail router, or the Internet (depending on how your network is set up.)


    Byteware, Inc. used to have a page that helped set up SMTP. It seems to no longer exist. Here are the contents of that page that should help you with setting up the SMTP server on your AS/400.

  • This section describes how to configure an SMTP gateway on your iSeries 400 or AS/400 so you can send E-mail messages. Your iSeries 400 or AS/400 does not have to be the mail server; you will be able to specify the mail server’s IP address during setup. Once completed, you will later be able to route your system messages to an E-mail address, and the iSeries 400 or AS/400 will automatically route to your mail server. Your mail server will then deliver the message as it normally would; either routing internally or sending to the Internet. The message is just like any other SMTP E-mail message; you will be able to receive it with any SMTP-compatible client, such as Lotus Notes, Domino, Miscrosoft Exchange, etc.

    Type CHGDSTA and press F4. If ‘Route to SMTP gateway’ is *NONE, continue with the following:

    1. Using CFGTCP, Option 10=Work with TCP/IP host table entries, verify your mail server name is in the table (add if necessary).
    2. From the command line, type PING mail-server-name to verify connection is working properly
    3. Using CHGSMTPA, verify AUTOSTART(*YES) and MAILROUTER(mail-server-name).
    4. Run the following commands:

      ADDDIRE USRID(INTERNET GATEWAY)   +
         USRD(‘Internet SMTP gateway’) SYSNAME(INTERNET)   +
         PREFADR(NETUSRID *IBM ATCONTXT)

      CHGDSTA SMTPRTE(INTERNET GATEWAY)

    5. Verify server applications are started: STRTCPSVR *SMTP
    6. Send a test message:

                SNDDST TYPE(*LMSG) TOINTNET(E-mail address)    +
                    DSTD(‘Test message’) LMSG(‘Test message’)

    Verify message appears in client. If you receive error message CPF9006 "User not enrolled in system distribution directory.", either have an administrator or use the Work with Directory Entries (WRKDIRE) command to enroll you in the system directory.

  • I sent an email that was supposed to be HTML, but all I got was the HTML code, not a web page in the email. What did I do wrong?

    When sending HTML emails you need to make sure to change the header type from text/plain to text/html. Also, be sure that any links or graphics that are used in the email specify the full path to your server (ie src="http://www.myserver.com/images/logo.jpg", NOT src="/images/logo.jpg").

  • Does MAILTOOL work with Domino?

MAILTOOL uses the QtmmSendMail API which is part of MSF. This requires OS/400's SMTP server. MAILTOOL will work as is if you are using OS/400's SMTP server. If you are using Domino's SMTP server then you will need to run dual stack (both SMTP servers) and it will work fine.

Another option is to use the MAILTOOL Plus! Addon which can send emails independant of any other server. You can try the MAILTOOL Plus! addon by simply requesting a key from me. The MAILTOOL Plus! Addon allows you to completely bypass the IBM SMTP server and send mail directly to your mail router, or the Internet (depending on how your network is set up.)

© Copyright 1995-2008 BVS/Tools
Powered by the eRPG SDK