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.
Does MAILTOOL work with Google (GMail), Yahoo Mail, Microsoft Office 365, Microsoft Outlook and other Cloud Servers that require SSL, TLS and Authentication?
Yes! We have worked with many customers to help them set up their systems using MAILTOOL and MAILTOOL Plus to interact with a variety of cloud based servers including Google, Microsoft and Yahoo. We personally use Google Apps email so our IBM i requires this as well!
In face, we have introduced new features in MAILTOOL that allow you to bypass the Not Trusted errors so that you don't need to import new CAs ever time.
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 firstname.lastname@example.org. 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:
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 the jobs seem to end after attempting to send an email and you are on V5R3 or higher, you will need to change an attribute on the /tmp directory in the IFS using the following command:
CHGATR OBJ('/tmp') ATR(*RSTDRNMUNL) VALUE(*NO)
If you recently upgraded to OS V7R1 there is a new parameter on the CHGSMTPA command named Forwarding Hub Server (FWDHUBSVR) that needs to be set to the same value as the Mail Router parameter. If you need to change this, you will need to stop and restart the IBM SMTP server for the change to take affect.
If you have a recent version of MAILTOOL installed, contact us and we can help you to run a trace using MAILTOOL Plus.
We also have put together an article you can find here that may offer some assistance.
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.
I'm receiving the following error running MAILTOOL: "Error during initializing SSL. Permission Denied. RC(10) errno(3401)" or "Error initializing SSL Environment. RC(6003) Access to the key database is not allowed". What do I need to do to fix this?
This is because the user that is making the request does not have the proper authorities to the SSL keyring files and/or directory that are located in the IFS. The keyring files (on most systems) can be found by using the following command:
Normally running the following commands will fix this issue:
CHGAUT OBJ('/QIBM/UserData/ICSS/Cert/Server') USER(*PUBLIC) DTAAUT(*RX)
CHGAUT OBJ('/QIBM/UserData/ICSS/Cert/Server/*') USER(*PUBLIC) DTAAUT(*R)
I got a File Full Error Message when running MAILTOOL. Are there log files that need to be maintaned?
Additional Message Information
number of increments, and add the record to the file.
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 corrupted. 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:
What are all the MAILTOOL Data Areas for? I see messages saying they can't be found!
MLTNEWLINE - Used for the newline in an email. Defaults to \n. If you want to create it, just do this:
CRTDTAARA DTAARA(QGPL/MLTNEWLINE) TYPE(*CHAR) LEN(2) VALUE('\n').
MLTMODEDA - This is for TEST mode. If this contains *TEST it will be in test mode and not actually send the email.
CRTDTAARA DTAARA(QTEMP/MLTMODEDA) TYPE(*CHAR) LEN(10) VALUE(' ')
MTPSAVE - This is for the system wide SAVE setting to save sent emails or not.
CRTDTAARA DTAARA(QTEMP/MTPSAVE) TYPE(*CHAR) LEN(20) VALUE('*NO')
MLTHOSTDA - This is used to override the host name on your system if you want to when using MAILTOOL Plus. You can just leave it blank:
CRTDTAARA DTAARA(QTEMP/MLTHOSTDA) TYPE(*CHAR) LEN(128) VALUE(' ')
Is it possible to call MAILTOOL from an RPG program?
Yes! This can be done using the new ILE subprocedures as well as the old method of the QCMDEXC API.
First, here is an example using the ILE subprocedures included with MAILTOOL v7.00 and up:
Following is a small example of how this can be done with QCMDEXC:
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.)
This section describes how to configure an SMTP gateway on your IBM i (iSeries, AS/400) so you can send E-mail messages. Your IBM i 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 IBM i 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:
Use CFGTCP option 12 and make you have the proper DNS servers listed so that you can ping your mail router and resolve to the IP address without adding a host table entry. You won't always get a response, but it should resolve the name to an IP address. You can add a host table entry if you want, but it's not recommended.
Using CHGSMTPA, verify AUTOSTART(*YES), MAILROUTER(mail-server-name), and FIREWALL(*YES). If you are on V7R1 or higher, you will also need to set the value of FWDHUBSVR to the same value as MAILROUTER.
Run the following commands:
ADDDIRE USRID(INTERNET GATEWAY) USRD(‘Internet SMTP gateway’) SYSNAME(INTERNET) PREFADR(NETUSRID *IBM ATCONTXT)
CHGDSTA SMTPRTE(INTERNET GATEWAY)
Verify server applications are started: STRTCPSVR *SMTP
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.)
I use Google/Gmail as my mail server and am trying to use MAILTOOL. What do I need to do?
First, you need to make sure you're using MAILTOOL Plus and specifying the right parameters:
AUTHUSER(your gmail userid)
AUTHPW(your gmail password)
If this still doesn't work and you receive errors like this in the job log:
Error performing SSL handshake. There is no error. RC(23) errno().
Error sending email.
This means that you don't have the proper Certificate Authorities installed on your machine to communicate with Google's SMTP server. Click Here to download the certificate authorities used by GMail, then follow the directions on this site to install them into the *SYSTEM store. You will import google1.cer first, then google2.cer into the *SYSTEM store.
How can I tell MAILTOOL and or SPL2EMAIL to use MAILTOOL Plus by Default Without Changing my Code?
To do this you can use the Change Command Default (CHGCMDDFT) command to change the defaults for the MAILTOOL, SPL2EMAIL and SPL2EMAILB commands. Simply copy and paste the following commands replacing "xx.xx.xx.xx" with the appropriate mail router: