smtp/400 email api - v1 - rjs support center

48
SMTP/400 Email API - V1.38 © 1995-2002 ... RJS Software Systems Inc. User Guide RJS Software Systems Inc. 14041 Burnhaven Drive, Suite 120 Burnsville, MN 55337 Phn: (952) 898-3038 Fax: (952) 898-1781 Sales Email: [email protected] Support Email: [email protected] Web Site: http://www.rjssoftware.com

Upload: others

Post on 12-Sep-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.38© 1995-2002 ... RJS Software Systems Inc.

User Guide

RJS Software Systems Inc. 14041 Burnhaven Drive, Suite 120

Burnsville, MN 55337

Phn: (952) 898-3038Fax: (952) 898-1781

Sales Email: [email protected] Email: [email protected]

Web Site: http://www.rjssoftware.com

Page 2: SMTP/400 Email API - V1 - RJS Support Center

Table of ContentsPart I SMTP/400 Email API 3

................................................................................................................................... 31 Overview .......................................................................................................................................................... 3Introduction to SMTP/400 Email API .......................................................................................................................................................... 3About RJS Software .......................................................................................................................................................... 3Licensing Information .......................................................................................................................................................... 3Contacting RJS Software Systems, Inc.

................................................................................................................................... 42 Installation .......................................................................................................................................................... 4Introduction to Installation .......................................................................................................................................................... 4AS/400 Prerequisites .......................................................................................................................................................... 4Email System Prerequisites .......................................................................................................................................................... 4AS/400 Installation .......................................................................................................................................................... 5AS/400 User Authorization Code Entry .......................................................................................................................................................... 5Deinstallation of SMTP/400

................................................................................................................................... 63 Getting Started .......................................................................................................................................................... 6Introduction to Getting Started .......................................................................................................................................................... 6Installing the SMTP/400 Software .......................................................................................................................................................... 6Overview of SMTP/400 Email API .......................................................................................................................................................... 7Configuring SMTP/400 for Initial Use

.......................................................................................................................................................... 10First Steps to Sending an Interactive Email

.......................................................................................................................................................... 12What's Next After Getting Started?

................................................................................................................................... 124 Main Menu .......................................................................................................................................................... 12Introduction to Main Menu .......................................................................................................................................................... 14Getting to the Main Menu .......................................................................................................................................................... 14Available Options on the Main Menu

................................................................................................................................... 185 AS/400 Commands .......................................................................................................................................................... 18Introduction to AS/400 Commands .......................................................................................................................................................... 18True SMTP Email Commands .......................................................................................................................................................... 18SMTPSIMPLE: Send Simple Interactive Email Message .......................................................................................................................................................... 20SMTPMAIL2: Send Email Message using Native SMTP .......................................................................................................................................................... 21SMTPMAIL64: Send Email Message using Native SMTP/Base64 .......................................................................................................................................................... 23SMTPSEND: Send Text Message or IFS File Attachments .......................................................................................................................................................... 26SMTPTEXT: Send Message from Text Member .......................................................................................................................................................... 28SMTPDB2: Send AS/400 Database using Native SMTP .......................................................................................................................................................... 32SMTPDB264: Send AS/400 Database using Native SMTP/Base64 .......................................................................................................................................................... 37Mail Server Framework Commands .......................................................................................................................................................... 37SMTPMAIL: Send Email Message using Mail Server Framework .......................................................................................................................................................... 39SMTPDB: Send AS/400 Database using Mail Server Framework

................................................................................................................................... 416 Programming Samples .......................................................................................................................................................... 41SMTPTEXT CL/RPG Sample

................................................................................................................................... 437 Problem Handling .......................................................................................................................................................... 43Common Errors .......................................................................................................................................................... 44SMTP Command Return Codes .......................................................................................................................................................... 46Sending SMTP Message via Telnet .......................................................................................................................................................... 47Other Errors

SMTP/400 Email API - V1.38I

© 1995-2002 ... RJS Software Systems Inc.

Page 3: SMTP/400 Email API - V1 - RJS Support Center

Index 0

IIContents

II

© 1995-2002 ... RJS Software Systems Inc.

Page 4: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.383

© 1995-2002 ... RJS Software Systems Inc.

1 SMTP/400 Email API

1.1 Overview

1.1.1 Introduction to SMTP/400 Email API

The SMTP/400 Email API software is a native OS/400 API used to send text or HTML based emailmessages and file attachments via SMTP using the AS/400 SMTP Server or via any other SMTPServer such as MS Exchange, Novell Groupwise, Lotus Domino, Lotus cc:Mail or any Unix/Linuxbased SMTP mail server.

The SMTP/400 software can be used with or without the AS/400 Mail Server Framework or SMTPServer running. This means that AS/400 shops who want to send email messages from the AS/400don't have to configure the mail server on the AS/400 in order to send messages.

If the customer is running Domino for the AS/400 as their mail server the SMTP/400 software will alsowork with the Domino for AS/400 SMTP mail server. The SMTP/400 software utilizes the built-inDomino SMTP Server when used with Domino for the AS/400.

1.1.2 About RJS Software

RJS Software is a privately-held software and hardware company dedicated to providing high-qualityAS/400 and Client/Server products and customer services. Customer Service is central to the company'sobjective. Read more about us on our web site.

Copyright© 1995-2002 by RJS Software Systems. All rights reserved. This manual and the software describedin it are copyrighted with all rights reserved. No part of this publication may be reproduced,transmitted, transcribed, stored in a retrieval system or translated into any language in any form byany means without the written permission of RJS Software Systems.

TrademarksSMTP/400™ is a trademark of RJS Software Systems. Brand names and product names aretrademarks or egistered trademarks of their respective companies.

1.1.3 Licensing Information

SMTP/400 is licensed on a per AS/400 parition basis.

The license allows an unlimited number of users to access the software from one licensed AS/400system parition.

1.1.4 Contacting RJS Software Systems, Inc.

For SMTP/400 technical support, please review the following information before contacting RJSSoftware Systems.

For Technical Support with SMTP/400.Because of the complexity of dealing with the various AS/400 connectivity environments, pleasegather and organize as much information as possible on the problem prior to contacting RJS SoftwareSystems for support.

If you have a question about an SMTP/400 operation, first browse through the Online Help to try to

Page 5: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 4

© 1995-2002 ... RJS Software Systems Inc.

find your answer prior to calling RJS Software Systems.

Contact InformationTelephone support is available on normal business days from 9:00 am to 5:00 pm central time.(952) 898-3038 Voice(952) 898-3038 Fax

Support is available via Email at [email protected].

You may also find the answer to your question on our web site: www.rjssoftware.com.

1.2 Installation

1.2.1 Introduction to Installation

This section covers the installation of the SMTP/400 software on the AS/400 system.

1.2.2 AS/400 Prerequisites

Before installing the SMTP/400 software, you must make sure that you have TCP/IP connectivityturned on. If TCP/IP is not active, the SMTP/400 software will not work.

1.2.3 Email System Prerequisites

You must have a SMTP Mail Server running somewhere in your network or you must have access toan Internet Service Provider SMTP Server in order to send mail with the SMTP/400 software.

You will need to know the IP address or TCP/IP host name of your SMTP mail server.

If you're not familiar with SMTP, please contact RJS Software Systems for assistance.

1.2.4 AS/400 Installation

This section includes instructions for restoring the SMTP/400 AS/400 library.

AS/400 Installation Using RSTLIB CommandInsert the RJS CD into the AS/400 CD Drive and sign on to the AS/400 with a user ID that hassecurity officer authority.

Run the following AS/400 command to restore the SMTP/400 library:RSTLIB SAVLIB(RJSSMTP) DEV(OPT01)

If you will be emailing AS/400 database files in CSV format you will also need to restore the RJS DataExport library as well.

Run the following AS/400 command to restore the RJS Data Export library:RSTLIB SAVLIB(RJSEXPORT) DEV(OPT01) OPTFILE('/RJSEXP')AS/400

AS/400 Installation Using FTPThis method of installation is described in the RJS Product Catalog and also on the RJS SoftwareSystems installation screen on the RJS CD-ROM.

Note: All web download packages contain an automated FTP upload utility.

Page 6: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.385

© 1995-2002 ... RJS Software Systems Inc.

1.2.5 AS/400 User Authorization Code Entry

Sign on to the AS/400 with a user ID that has security officer authority.

Entering SMTP/400 Access CodeAdd the RJSSMTP library to the user library list by typing: ADDLIBLE RJSSMTP and pressing Enter.

Go to the SMTP/400 main menu by typing: GO RJSSMTP1 and pressing Enter.

Take option 1 and enter the appropriate access codes listed on the access code sheet provided byRJS Software Systems.

If you have questions or problems with entering the access codes, contact RJS Software Systemsfor assistance.

Entering RJS Data Export Access Code (Optional)This code is only required if you want to send AS/400 database files as CSV attachments using theSMTP/400 software.

Add the RJSEXPORT library to the user library list by typing: ADDLIBLE RJSEXPORT and pressingEnter.

Type the following command and press Enter to prompt for the RJS Data Export access code:PRDSEC SECURITY() DTAARA(RJSEXPORT) DTALIB(RJSEXPORT)

Type the access code and press Enter to save the access code entry.

If you have questions or problems with entering the access codes, contact RJS Software Systemsfor assistance.

1.2.6 Deinstallation of SMTP/400

The following sections describe how to remove the SMTP/400 software from an AS/400 system.

Removing SMTP/400 from an AS/400To remove SMTP/400 from an AS/400, perform the following individual steps.

Make sure the RJSSMTP library is not being used.

Delete the RJSSMTP library from the AS/400 by entering the following command:DLTLIB LIB(RJSSMTP)

Removing RJS Data Export from an AS/400To remove RJS Data Export from an AS/400, perform the following individual steps.

Make sure the RJSEXPORT library is not being used.

Delete the RJSEXPORT library from the AS/400 by entering the following command:DLTLIB LIB(RJSEXPORT)

Page 7: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 6

© 1995-2002 ... RJS Software Systems Inc.

1.3 Getting Started

1.3.1 Introduction to Getting Started

The purpose of this section is to describe how to quickly get started using the SMTP/400 Email API tostart sending email from your AS/400 system.

1.3.2 Installing the SMTP/400 Software

If you haven't installed the software yet, go back to the installation section and install the softwarebefore continuing. If you're just reading ahead to find out what to do, then please continue.

1.3.3 Overview of SMTP/400 Email API

What is SMTP ?Quite simply, SMTP is a standard protocol for sending email via the Internet or Intranet. If you're notsure whether you have a SMTP mail server configured in your network, you will need to talk to yournetwork administrator or contact RJS Software Systems before you start attempting to use theSMTP/400 Email API.

The concept behind the SMTP/400 Email API is that AS/400 users and application developers needan easy way to send email messages from the AS/400 without requiring a lot of programming effort orconfiguration to do so. Most companies have a SMTP email system already in place to send mail tothe Internet or they use the AS/400 mail server or Domino for AS/400 mail server to send out SMTPbased email. However they don't have an easy way to take advantage of sending email fromtraditional green-screen applications.

SMTP/400 provides an easy to use method for sending email messages and file attachments fromany RPG, CL or COBOL program. The software can also be used from the AS/400 command line tosend email messages or file attachments and contains an interactive interface for sending simple textemail messages.

Listed below are some of the ways that SMTP/400 can be utilized in traditional AS/400 applicationdevelopment scenarios:

Text based order acknowledgements and customer invoices can be automatically sent from AS/400applications.

If a customer has gone over their credit limit, an email message can be sent to them notifying them oftheir status.

Electronic statements or receipts can be sent to customers via email in text or HTML format.

Email messages can be sent to notify employees of system events or problems.

AS/400 applications can automatically send out notifications based on application events.

Links to web sites or documents on the AS/400 or Domino Server can be sent out via email.

Email and notifications can be sent out to electronic pagers if the pager supports email messages.

A copy of an AS/400 database file can be emailed out in CSV format.

An AS/400 spool file can be emailed out as a text attachment.

The possibilities for utilizing the SMTP/400 email API are limited only by your imagination.

Page 8: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.387

© 1995-2002 ... RJS Software Systems Inc.

If you have a scenario you would like to discuss, please contact RJS Software Systems forassistance.

1.3.4 Configuring SMTP/400 for Initial Use

Before using the SMTP/400 software for the first time, you need to set up your SMTP hostinformation and a default From email address.

Creating a Host Table Entry for your SMTP Server1. Obtain the IP address of your SMTP mail server from your mail administrator.

2. You need to create a host entry that points to your SMTP mail server. Sign on to the AS/400 andgo to the TCP/IP configuration menu (GO CFGTCP) and select option 10 (Work with TCP/IP hosttable entries).

3. See if you IP address is already listed.

Work with TCP/IP Host Table Entries List

4. If you IP address was listed, take note of the host name. Otherwise type option 1 and press Enterto create a new host entry.

5. Enter the IP address and host name you would like to use. If you're not sure what to enter for ahost name, use SMTPMAIL as the host name when you enter your SMTP server IP address. Thehost name can be anything as long as the IP address is entered as supplied by your mailadministrator.

Page 9: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 8

© 1995-2002 ... RJS Software Systems Inc.

Adding a new TCP/IP Host Entry

Press Enter to create the new host table entry.

Setting up the SMTP/400 Initial Settings

1. Add the SMTP/400 library to your library list using the following command: ADDLIBLE RJSSMTP

2. Go to the SMTP/400 main menu: GO RJSSMTP

3. Select option 3 to Set the Default SMTP Host.

4. Enter *SET for the option and enter the host name for your SMTP mail server.

Page 10: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.389

© 1995-2002 ... RJS Software Systems Inc.

Setting the Default Mail Host Name

Press Enter to save the mail host information. You can run this option again with *DSP as the optionto display the current data area value.

5. Select option 4 to Set the Default From Address

6. Enter *SET for the option and enter the email address where mail should bounce back to ifundeliverable.

Page 11: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 10

© 1995-2002 ... RJS Software Systems Inc.

Setting the Default From Email Address

Press Enter to save the from address information. You can run this option again with *DSP as theoption to display the current data area value.

The basic SMTP/400 configuration is complete. You should now be ready to attempt sending yourfirst email message with SMTP/400.

1.3.5 First Steps to Sending an Interactive Email

Let's begin by sending our first interactive email from the AS/400.

Sign on to the AS/400 system and add the RJSSMTP library to your library list by using the followingAS/400 command: ADDLIBLE RJSSMTP.

Next type: GO RJSSMTP and press enter. This will take you to the SMTP/400 main menu.

Take Option 10. (Send Simple Interactive Message) and the Send Simple Email Message Screen willbe displayed.

Page 12: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3811

© 1995-2002 ... RJS Software Systems Inc.

Send Simple Email Message Screen

Enter the Internet email address of someone you want to send a test email message to in the ToEmail Address: field. Example: [email protected]

Enter your own Internet email address in the From Email Address: field.

If the email message bounces back or is undeliverable for any reason, a notification will go to theemail address listed here.

If you're using the AS/400 as your mail server, you can leave LOCALHOST in the SMTP ServerName field, otherwise enter the host name or TCP/IP address for your SMTP mail server.

Remember, the AS/400 mail server does not have to be running if you have a SMTP Server such asMS Exchange, Lotus Notes, etc.

Note: If you don't know your SMTP Server address or host name, contact your network administrator.

Type the email Subject and also enter some text in the Message area and press Enter to send theemail message.

Check your email box to see if you received the email message.

That's all there is to it. You've sent your first email message directly from the AS/400.

If you have problems getting this option to work, contact RJS Software Systems for assistance.

Page 13: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 12

© 1995-2002 ... RJS Software Systems Inc.

1.3.6 What's Next After Getting Started?

You should now have the basics down for sending interactive email messages.

The next few sections are a reference for each of the SMTP/400 commands and availableparameters.

1.4 Main Menu

1.4.1 Introduction to Main Menu

This section gives an overview of the SMTP/400 main menu and the available options.

SMTP/400 Main Menu 1

Page 14: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3813

© 1995-2002 ... RJS Software Systems Inc.

SMTP/400 Main Menu 2

Page 15: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 14

© 1995-2002 ... RJS Software Systems Inc.

SMTP/400 Main Menu 3

1.4.2 Getting to the Main Menu

Sign on to the AS/400 system and add the RJSSMTP library to your library list using the followingAS/400 command: ADDLIBLE RJSSMTP.

Next type: GO RJSSMTP and press Enter. This will take you to the SMTP/400 main menu.

1.4.3 Available Options on the Main Menu

Option 1 – Enter SMTP/400 License CodeThis menu option is used to enter the AS/400 access code for the SMTP/400 software. An accesscode will be provided to you by RJS Software Systems Inc.

Option 2 – Enter SMTP/400 Base64 Encoding License CodeThis menu option is outdated and no longer used. The Base64 licensing has been built in to theSMTP/400 license code.

Option 3 – Set Default SMTP HostThis menu option is used to enter the host name for the SMTP mail server you will be using to deliveremail messages.

If you don't have a SMTP host name configured for your SMTP server, use the GO CFGTCP menu,option 10 to add a host entry for your SMTP server.

Note: You do not have to configure or start the AS/400 SMTP server. Any SMTP mail server will work

Page 16: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3815

© 1995-2002 ... RJS Software Systems Inc.

with SMTP/400

Option 4 – Set Default From AddressThis menu option is used to enter the default FROM: email address where email messages willbounce back to if delivery fails.

Option 5 – Set Default Zip File ExtensionThis menu option is used to enter the default zip file extension to use with SMTP/400 when zippingreports.

Normally this option should not be changed.

Option 6 – Set Default SMTP PortThis menu option is used to enter the TCP/IP port to use with SMTP/400. Most SMTP servers useport 25, but if your SMTP server does not use port 25, this setting can be changed to match yourSMTP mail server settings.

Option 7 – Set Use ASI PKZIP SettingThis menu option is used to enable the use of the ASI PKZIP software for zipping files. SMTP/400 hasbuilt in ZIP support, but if password protected zipping is required for attachments, the ASI PKZIPsoftware can be used for zipping attachments. Both versions 4 and 5 of the ASI PKZIP software aresupported.

Option 8 – Set Use ASI PKZIP Library NameThis menu option is used to set the ASI PKZIP software library name based on where the ASI PKZIPsoftware was installed.

Option 10 – Send Simple Interactive Message (Using True SMTP)This menu option is used to access the SMTPSIMPLE command that displays a simple email entryscreen for sending a text message. The SMTPSIMPLE command sends the text message using theNative SMTP mail protocol. This interface can be used to quickly send text-based email messages.

Option 11 – Send Text Message API (Using AS/400 MSF)This menu option is used to access the SMTPMAIL command which can be used to send a textmessage or an IFS file attachment that contains plain ASCII data. The SMTPMAIL command uses theAS/400 Mail Server Framework API QtmmSendMail to send the mail message.

Note: Typically you should use the SMTPMAIL2 or SMTPSEND commands to send text messagesbecause they send emails via the native SMTP protocol and bypass the AS/400 Mail ServerFramework.

Option 12 – Send Text Message API (Using True SMTP)This menu option is used to access the SMTPMAIL2 command which can be used to send a textmessage or an IFS file attachment that contains plain ASCII data. SMTPMAIL64 or SMTPSENDshould be used to send binary attachments.

The SMTPMAIL2 command uses the Native SMTP mail protocol to send the mail message.

Note: The SMTPMAIL2 command functionality has been replaced by the SMTPSEND command.SMTPSEND should typically be used instead of SMTPMAIL2 because it supports up to 30 recipientaddresses and 30 file attachments from the IFS. SMTPMAIL2 will continue to function, but werecommend replacing SMTPMAIL2 usage with the SMTPSEND command.

Option 13 – Send Message from Text Member (Using True SMTP)This menu option is used to access the SMTPTEXT command which can be used to send an unlimited

Page 17: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 16

© 1995-2002 ... RJS Software Systems Inc.

sized text or HTML message from an AS/400 database file. This command is typically utilized bydevelopers who want to create dynamic text or HTML messages of varying size from within an RPGor COBOL program. This is a great way to send out HTML based invoices and statements.

The SMTPTEXT command uses the Native SMTP mail protocol to send the mail message.

Option 15 – Send Base64 File Attachment (Using True SMTP)This menu option is used to access the SMTPMAIL64 command which can be used to send a textmessage or an IFS file attachment that contains plain ASCII data or binary data such as a WordDocument or PDF File. SMTPMAIL64 also supports the zipping of file attachments.

The functionality of the SMTPMAIL64 command is similar to SMTPMAIL2, except that SMTPMAIL64supports binary file attachments.

The SMTPMAIL64 command uses the Native SMTP mail protocol to send the mail message.

Note: The SMTPMAIL64 command functionality has been replaced by the SMTPSEND command.SMTPSEND should typically be used instead of SMTPMAIL64 because it supports up to 30 recipientaddresses and 30 file attachments from the IFS. SMTPMAIL64 will continue to function, but werecommend replacing SMTPMAIL64 usage with the SMTPSEND command.

The SMTPMAIL64 command uses the Native SMTP mail protocol to send the mail message.

Option 16 – Send Text Message with Multiple AttachmentsThis menu option is used to send a text email message and/or file attachment(s) via the SMTPSENDcommand. SMTPSEND supports a 5000 character message buffer, up to 30 recipient addresses and30 file attachments from the IFS. This command also supports the zipping of file attachments.

Note: The SMTPSEND command combines the functionality of the SMTPMAIL2 and SMTPMAIL64commands, so therefore the SMTPMAIL2 and SMTPMAIL64 commands can be replaced by calls toSMTPSEND. SMTPMAIL2 and SMTPMAIL64 will be maintained for compatability, but all futuredevelopment efforts will focus around the SMTPSEND command.

The SMTPSEND command uses the Native SMTP mail protocol to send the mail message.

Option 20 – Send AS/400 File API (Using AS/400 MSF)This menu option is used to access the SMTPDB command which can be used to send any AS/400database member formatted as an ASCII Comma Separated Variable (CSV) file attachment. CSV is astandard interchange format that can be read by MS Excel, Access and many other PC applications.The SMTPDB command uses the AS/400 Mail Server Framework API QtmmSendMail to send the mailmessage.

Note: Typically you should use the SMTPDB2 or SMTPDB264 commands because they send emailsvia the native SMTP protocol and bypass the AS/400 Mail Server Framework.

Option 21 – Send AS/400 File API (Using True SMTP)This menu option is used to access the SMTPDB2 command which can be used to send any AS/400database member formatted as an ASCII Comma Separated Variable (CSV) file attachment. CSV is astandard interchange format that can be read by MS Excel, Access and many other PC applications.The SMTPDB2 command uses the uses the Native SMTP mail protocol to send the mail message.

Note: This command requires a license for the RJS DataExport/400 software for file translation.

Option 22 – Send AS/400 File API (Using True SMTP/Base64)This menu option is used to access the SMTPDB264 command which can be used to send any

Page 18: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3817

© 1995-2002 ... RJS Software Systems Inc.

AS/400 database member formatted as an ASCII Comma Separated Variable (CSV) file attachment.CSV is a standard interchange format that can be read by MS Excel, Access and many other PCapplications. The SMTPDB264 command uses the uses the Native SMTP mail protocol to send themail message.

Note: SMTP264 is a variation of the SMTPDB2 command that will Base64 encode the AS/400database file attachment before emailing. Some customers have had problems with file corruptionwhen using SMTPDB2 to send AS/400 file attachments. If you have problems using the SMTPDB2command, use SMTPDB264 instead.

SMTPDB264 also supports the zipping of file attachments.

Note: This command requires a license for the RJS DataExport/400 software for file translation.

Option 30 – Send HTML Sample Message using SMTPTEXTThis menu option is used to send a sample HTML message using the SMTPTEXT command. Use thisoption to illustrate how SMTPTEXT can be used to send HTML messages.

Option 40 – Ping Remote SMTP ServerThis menu option is used to ping a TCP/IP host. This is a good way to see if the AS/400 can see yourSMTP mail server.

Option 41 – Connect to SMTP Server via TelnetThis menu option is used to connect to an SMTP server on port 25 via Telnet. This is a good way tosee if the AS/400 can connect to your SMTP mail server.

Option 42 – AS/400 TCP/IP Configuration MenuThis menu option is used to go to the AS/400 TCP/IP configuration menu. (GO CFGTCP)

Option 43 – Enable/Disable SMTP Session DebuggingThis menu option is used to enable or disable the SMTP debug option for SMTP/400. If enabled, allSMTP session information is logged so that RJS can help troubleshoot SMTP connectivity issues.

Note: When option SMTP session debugging is enabled, the session debug printing should also beenabled.

Option 44 – Enable/Disable SMTP Session Debug PrintingThis menu option is used to enable or disable the SMTP debug printing option for SMTP/400. Ifenabled, all SMTP session information is logged and printed so that RJS can help troubleshoot SMTPconnectivity issues.

Note: When option SMTP session debugging is enabled, the session debug printing should also beenabled.

Option 50 – Display SMTP Mail Log EntriesThis menu option is used to display entries added to SMTP/400 email history log.

Note: The Write Log Entry After Mailing flag must be set to *YES on the email command being usedif you want to write entries to the history log after mailing.

Option 51 – Clear SMTP Mail Log EntriesThis menu option is used to clear entries from the SMTP/400 email history log.

Page 19: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 18

© 1995-2002 ... RJS Software Systems Inc.

1.5 AS/400 Commands

1.5.1 Introduction to AS/400 Commands

This section gives an overview of the SMTP/400 AS/400 commands. The SMTP/400 commands canbe embedded in any RPG, CL or COBOL program as well as any other AS/400 language.

1.5.2 True SMTP Email Commands

The commands listed in the next sections utilize True SMTP Email Processing. These commands cantalk to any SMTP mail server for sending email messages.

Since these commands use True SMTP, the AS/400 SMTP Server and Mail Server Framework isnot required to use the True SMTP commands.

1.5.3 SMTPSIMPLE: Send Simple Interactive Email Message

The SMTPSIMPLE command is used to display a simple email entry screen for sending a textmessage.

The SMTPSIMPLE command sends the text message using the Native SMTP mail protocol. Thisinterface can be used to quickly send interactive text-based email messages.

SMTPSIMPLE Command Parameters

Page 20: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3819

© 1995-2002 ... RJS Software Systems Inc.

SMTPSIMPLE Interactive Entry Screen

All parameters passed to this command are optional. If the parameters are not passed in, the SendSimple Email Message screen will be displayed with no information filled in. If any of the parametersare passed, the selected information will be filled in before the screen is displayed. This allows theSend Simple Email Message screen to be integrated into interactive email applications on theAS/400.

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address by the mailsystem. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused.

Page 21: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 20

© 1995-2002 ... RJS Software Systems Inc.

1.5.4 SMTPMAIL2: Send Email Message using Native SMTP

The SMTPMAIL2 command is used to send a text message or an IFS file attachment that containsplain ASCII data.

The SMTPMAIL2 command uses the Native SMTP mail protocol to send the mail message.

Note: The SMTPMAIL2 command functionality has been replaced by the SMTPSEND command.SMTPSEND should typically be used instead of SMTPMAIL2 because it supports up to 30 recipientaddresses and 30 file attachments from the IFS. SMTPMAIL2 will continue to function, but werecommend replacing SMTPMAIL2 usage with the SMTPSEND command.

SMTPMAIL2 Command Parameters

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

Page 22: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3821

© 1995-2002 ... RJS Software Systems Inc.

ASCII Text File AttachmentThis parameter holds the IFS file attachment name. Example: /CUSTORD.TXT This example wouldsend the file CUSTORD.TXT. CUSTORD.TXT is stored in the root directory of the Integrated File System.

Only one file is currently allowed for attachment.

Internal File Attachment NameThis parameter allows a file attachment to be renamed inside the email messages.

*ATTACHNAME is the default setting which will name the internal file attachment the same as the IFSfile name.

Example:An IFS attachment could have one name such as REPORT.CSV in the IFS and the name could bechanged to SALESREPORT.CSV in the email message.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

Mime Content TypeThis parameter tells SMTP/400 whether the user will be formatting the email message in text or HTMLformat. This setting does not actually format the message text. It just tells the SMTP mail server whatthe format of the message will be.

text/plain - A plain text message will be sent.

text/html - An HTML formatted message will be sent.

Write Log Entry After EmailingThis parameter tells SMTP/400 to write a log entry to the SMTP/400 History Log File (SMTPLOG00)indicating success or failure of an email message delivery to the outbound SMTP server.

Note: This entry does not tell if the email recipient actually got the message. It simply tells whetherSMTP/400 was able to forward the message for delivery to the specified SMTP server.

1.5.5 SMTPMAIL64: Send Email Message using Native SMTP/Base64

The SMTPMAIL64 command is used to send a text message or any IFS file attachment, including MSWord documents, PDF documents, etc.

The SMTPMAIL64 command uses the Native SMTP mail protocol to send the mail message.

SMTPMAIL64 also supports the zipping of file attachments.

Note: The SMTPMAIL64 command functionality has been replaced by the SMTPSEND command.SMTPSEND should typically be used instead of SMTPMAIL64 because it supports up to 30 recipientaddresses and 30 file attachments from the IFS. SMTPMAIL64 will continue to function, but werecommend replacing SMTPMAIL64 usage with the SMTPSEND command.

Page 23: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 22

© 1995-2002 ... RJS Software Systems Inc.

SMTPMAIL64 Command Parameters

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

ASCII File AttachmentThis parameter holds the IFS file attachment name.

Only one file is currently allowed for attachment.

Internal File Attachment NameThis parameter allows a file attachment to be renamed inside the email messages.

*ATTACHNAME is the default setting which will name the internal file attachment the same as the IFSfile name.

Example:

Page 24: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3823

© 1995-2002 ... RJS Software Systems Inc.

An IFS attachment could have one name such as REPORT.CSV in the IFS and the name could bechanged to SALESREPORT.CSV in the email message.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

Compress AttachmentThis setting determines if the file attachment will be compressed with PKZIP compatible compressionbefore sending.

*NO - Attachment is not compressed. (Default)*YES - Attachment is compressed.

Compression PasswordThis setting determines if the file attachment will be compressed with a compression password.

Note: The ZIP password setting does not work unless the ASI PKZIP setting is enabled via theSMTPASIZIP and SMTPZIPLIB commands.

Write Log Entry After EmailingThis parameter tells SMTP/400 to write a log entry to the SMTP/400 History Log File (SMTPLOG00)indicating success or failure of an email message delivery to the outbound SMTP server.

Note: This entry does not tell if the email recipient actually got the message. It simply tells whetherSMTP/400 was able to forward the message for delivery to the specified SMTP server.

1.5.6 SMTPSEND: Send Text Message or IFS File Attachments

The SMTPSEND command is used to send a text message or IFS file attachment(s), including MSWord documents, PDF documents, etc.

SMTPSEND supports a 5000 character message buffer, up to 30 recipient addresses and 30 fileattachments from the IFS. This command also supports the zipping of file attachments.

The SMTPSEND command uses the Native SMTP mail protocol to send the mail message.

Note: The SMTPSEND command combines the functionality of the SMTPMAIL2 and SMTPMAIL64commands, so therefore the SMTPMAIL2 and SMTPMAIL64 commands can be replaced by calls toSMTPSEND. SMTPMAIL2 and SMTPMAIL64 will be maintained for compatability, but all futuredevelopment efforts will focus around the SMTPSEND command.

Page 25: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 24

© 1995-2002 ... RJS Software Systems Inc.

SMTPSEND Command Parameters

To Email AddressesThis parameter holds the To Email Addresses where the message will be sent.

Up to 30 email recipients can be entered.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

IFS File AttachmentThis parameter holds the IFS file attachment names.

Up to 30 file attachments can be sent.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

Page 26: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3825

© 1995-2002 ... RJS Software Systems Inc.

Compress AttachmentThis setting determines if the file attachment will be compressed with PKZIP compatible compressionbefore sending.

*NO - Attachment is not compressed. (Default)*YES - Attachment is compressed.

Compression PasswordThis setting determines if the file attachment will be compressed with a compression password.

Note: The ZIP password setting does not work unless the ASI PKZIP setting is enabled via theSMTPASIZIP and SMTPZIPLIB commands.

Mime Content TypeThis parameter tells SMTP/400 whether the user will be formatting the email message in text or HTMLformat. This setting does not actually format the message text. It just tells the SMTP mail server whatthe format of the message will be.

text/plain - A plain text message will be sent.

text/html - An HTML formatted message will be sent.

Delivery confirmation requestReturn a delivery confirmation to the from address after the email message has been delivered.

*NO - A confirmation request is not sent. (Default)*YES - A confirmation request is sent.

Note: This setting is not 100% reliable and may or may not work. It's dependent on the SMTP mailserver settings for the email recipient.

Read confirmation requestReturn a read confirmation to the from address after the email message has been opened by theemail recipient.

*NO - A confirmation request is not sent. (Default)*YES - A confirmation request is sent.

Note: This setting is not 100% reliable and may or may not work. It's dependent on the SMTP mailserver settings for the email recipient.

High priority requestThis message is sent with a high priority indicator.

*NO - Not high priority. (Default)*YES - High priority.

Note: This setting is not 100% reliable and may or may not work. It's dependent on the SMTP mailserver settings for the email recipient.

Write Log Entry After EmailingThis parameter tells SMTP/400 to write a log entry to the SMTP/400 History Log File (SMTPLOG00)indicating success or failure of an email message delivery to the outbound SMTP server.

Note: This entry does not tell if the email recipient actually got the message. It simply tells whether

Page 27: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 26

© 1995-2002 ... RJS Software Systems Inc.

SMTP/400 was able to forward the message for delivery to the specified SMTP server.

Delete temp IFS work filesThis setting should only be changed if you are working with RJS to troubleshoot email problems.

*YES - Delete IFS work files from directory /RJSTEMP after email has been sent. (Default)*NO - Do not delete IFS work files from directory /RJSTEMP after email has been sent.

1.5.7 SMTPTEXT: Send Message from Text Member

The SMTPTEXT command can be used to send an unlimited sized text or HTML message from anAS/400 database file. This command is typically utilized by developers who want to create dynamictext or HTML messages of varying size from within an RPG or COBOL program. This is a great wayto send out HTML based invoices and statements.

SMTPTEXT reads the selected message file and builds an email message line by line. A CR/LF isplaced at the end of each line automatically.

SMTPTEXT can also create mixed HTML and text messages. These are usually called multi-partmessages. The benefit of a multi-part message is that a combined HTML and text message can besent. If the recipients mail client can read HTML, the HTML version of the message isdisplayed.otherwise the text version can be displayed. Multi-part messages are more work to programthough because a text and HTML version of the message must be created.

Once the message has been sent the mesage member can be retained or cleared to reset for thenext message.

The SMTPTEXT command uses the Native SMTP mail protocol to send the mail message.

Note: When using the SMTPTEXT command, the command can read any single field 512 byte AS/400database file as input. When you create your message, you must use a single field 512 byte outputrecord, even if you don't use the entire field width. Sample command to create a 512 byte flat file:CRTPF FILE(QTEMP/SMTPMSG) RCDLEN(512) SIZE(*NOMAX)

See the SMTPTEXT CL/RPG Sample for a programming sample.

Page 28: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3827

© 1995-2002 ... RJS Software Systems Inc.

SMTPTEXT Command Parameters

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

From NameThis parameter holds the Name associated with the from email address.

Example: If the email address is [email protected], the name might be 'Technical Support Dept'

Note: The SMTPFRNAM command can be used to create this setting.

SubjectThis parameter holds the Subject of the email message.

From message text file name (First Part)This parameter holds the name of an AS/400 file and data member where the message text will beread from.

Mime Content Type (First Part)This parameter tells SMTP/400 whether the user will be formatting the email message in text or HTMLformat. This setting does not actually format the message text. It just tells the SMTP mail server whatthe format of the message will be.

Page 29: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 28

© 1995-2002 ... RJS Software Systems Inc.

text/plain - A plain text message will be sent.

text/html - An HTML formatted message will be sent. (Default)

Clear member after emailing (First Part)Should the AS/400 file member be cleared after emailing.

*NO - Do not clear the data member (Default)*YES - Clear the data member.

Create multipart messageThis setting can be used if a multipart message will be created where half the message is text and theother half is HTML. This is a nice way to send a text message, but if the users mail client supportsHTML, they can view the message in HTML format.

If creating a multipart message, the MIME Content type for the first part should be text/html and thesecond part should be text/plain.

*NO - Do not create a multi part message. (Default)*YES - Create a multi part message

From message text file name 2 (Second Part)This parameter holds the name of an AS/400 file and data member where the message text will beread from if sending a multi-part message

Mime Content Type 2 (Second Part)This parameter tells SMTP/400 whether the user will be formatting the email message part in text orHTML format. This setting does not actually format the message text. It just tells the SMTP mailserver what the format of the message will be.

text/plain - A plain text message will be sent. (Default)

text/html - An HTML formatted message will be sent.

Clear member after emailing 2 (Second Part)Should the AS/400 file member be cleared after emailing.

*NO - Do not clear the data member (Default)*YES - Clear the data member.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

1.5.8 SMTPDB2: Send AS/400 Database using Native SMTP

The SMTPDB2 command is used to reformat and send any AS/400 database member formatted asan ASCII Comma Separated Variable (CSV) file attachment. CSV is a standard interchange format that can beread by MS Excel, Access and many other PC applications.

The SMTPDB2 command uses the Native SMTP mail protocol to send the mail message.

Page 30: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3829

© 1995-2002 ... RJS Software Systems Inc.

Note: This command requires a license for the RJS DataExport/400 software for file translation.

SMTPDB2 Command Parameters

From File NameThis parameter holds the name of the AS/400 Database File which will be reformatted and sent inCSV format.

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

Internal File Attachment NameThis parameter allows a file attachment to be renamed inside the email messages.

*AS400FILE is the default setting which will name the internal file attachment based on the AS/400file selected for conversion.

Page 31: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 30

© 1995-2002 ... RJS Software Systems Inc.

Example:If file name CUSTMAST is selected, the attachment name will be CUSTMAST.CSV.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

Record DelimiterThis option determines the character sequence that will be placed at the end of each data line todenote a new line of data.

*CRLF - A carriage return/line feed combination is placed at the end of the record. (Default)*LF - A line feed is placed at the end of the record.*CR - A carriage return is placed at the end of the record.*CRLF - A line feed/carriage return combination is placed at the end of the record.

Output last record delimiterThis option determines if the record delimiter value gets output after the last record in the file. In somerare situations, you may want a file created without a record delimiter after the last record in anoutput file.

*YES - Output record delimiter after last record. (Default)*NO - Don't output record delimiter after last record.

Record format of output fileThis option determines which output PC data type to use when the AS/400 file getsconverted.

*CSV - Comma Separated Variable. CSV is the most widely used export format. This format can beautomatically opened by MS Excel, MS Access and can be opened or imported by just about any PCsoftware product that has a data import feature. (Default)

*TBL - Fixed Length ASCII Format. Some software packages can only import from a fixed lengthASCII record. The fixed length format is useful when an application must write to a fixed length outputfile because the application that will read the file requires a fixed length format. In general, you shouldattempt to use *CSV instead of fixed length if possible.

*HTM - HTML Table Format. HTML format is an ideal way to publish AS/400 table queries to a website on a daily basis. HTML tables as well as the other formats can be emailed with SMTP/400 toprovide daily email updates to a remote user. The HTML tables can also be published via FTP/400 orbasic AS/400 FTP to any web site. If using the AS/400 web server, the resulting HTML file can besimply converted to an IFS folder and the table file will be immediately available via the AS/400 webserver.

*XML - XML Table Format. XML table format is an ideal way to publish AS/400 table queries to a website or send data to an EDI provider on a regular basis. Users can then create XSL style sheets withtheir favorite HTML editor to allow the XML files to be easily viewed from the web.

Future direction: The future direction for XML output is to be able to publish one or more parent/childrelationships for applications such as sending invoices, orders, etc. where the information isn'tpresented in a single table format. Contact RJS Software Systems if you would like to further discussXML formatting.

Page 32: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3831

© 1995-2002 ... RJS Software Systems Inc.

*SV - Do not use this format. It is basically the same as *CSV, so use the *CSV format instead.

Field delimiterWhen *CSV is used for the output format, the field delimiter setting determine the value placedbetween each field in the output file. Usually a comma is placed between each record, but someapplications use a different delimiter such as a tab value, tilde - ~, pipe - | etc.

*COMMA - Place a comma between each record.(Default)*BLANK - Place a blank character between each record.*TAB - Place a tab character between each record.Character value - Key any other single character value that you would like to use instead of acomma, blank or tab character.

Output column headingsEnable this setting if you want the first record in the output file to contain column headings.

*YES - Output column headings in first record.*NO - Don't output column headings in first record.(Default)

Output quotes around textEnable this setting if you want all text values to be surrounded with double quotes. Some applicationsrequire quotes to be placed around all text values and some do not.

Example text with double quotes: "This is a test"Example text without double quotes: This is a test

*YES - Output quotes around text. (Default)*NO - Don't output quotes around text.

XML/HTML Report HeadingEnter the report/file heading for the selected HTML table report or XML file. This is a descriptive titlethat will be placed in the resulting HTML or XML file as a heading.

XML/XSL Stylesheet URLEnter the URL of the location of the XSL style sheet used to display the XML file when viewed withInternet Explorer. XSL style sheets allow XML to be displayed in a selected table format.

If you are not yet familiar with XSL style sheets, use the Web site listed below or your favorite XMLsite to learn more about XSL style sheets and XML.http://www.xml101.com

HTML Heading Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Heading Foreground Color.

#FFFFFF - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Heading Background ColorThis setting will output the 6 digit color value to be used for the HTML Heading Background Color.

#800000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:

Page 33: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 32

© 1995-2002 ... RJS Software Systems Inc.

http://www.rjssoft.com/htmlcolor.htm

HTML Text Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Text Foreground Color.

#000000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Text Background ColorThis setting will output the 6 digit color value to be used for the HTML Text Background Color.

#F7EFDE - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Title Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Title Foreground Color.

#000000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

Column Heading InfoThis setting determines the format of the column headings if they are output.

*FLDNAME - Output the field name from the AS/400 file being converted. (Default)*COLHDG1 - Output the column heading 1 value from the AS/400 file definition.*COLHDG2 - Output the column heading 2 value from the AS/400 file definition.*COLHDG3 - Output the column heading 3 value from the AS/400 file definition.*FLDTEXT - Output the field text value from the AS/400 file definition.

Mime Content TypeThis parameter tells SMTP/400 whether the user will be formatting the email message in text or HTMLformat. This setting does not actually format the message text. It just tells the SMTP mail server whatthe format of the message will be.

text/plain - A plain text message will be sent.

text/html - An HTML formatted message will be sent.

Write Log Entry After EmailingThis parameter tells SMTP/400 to write a log entry to the SMTP/400 History Log File (SMTPLOG00)indicating success or failure of an email message delivery to the outbound SMTP server.

Note: This entry does not tell if the email recipient actually got the message. It simply tells whetherSMTP/400 was able to forward the message for delivery to the specified SMTP server.

1.5.9 SMTPDB264: Send AS/400 Database using Native SMTP/Base64

The SMTPDB264 command is used to reformat and send any AS/400 database member formatted asan ASCII

Page 34: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3833

© 1995-2002 ... RJS Software Systems Inc.

Comma Separated Variable (CSV) file attachment. CSV is a standard interchange format that can beread by MS Excel, Access and many other PC applications.

The SMTPDB264 command uses the Native SMTP mail protocol to send the mail message.

Note: SMTP264 is a variation of the SMTPDB2 command that will Base64 encode the AS/400database file attachment before emailing. Some customers have had problems with file corruptionwhen using SMTPDB2 to send AS/400 file attachments. If you have problems using the SMTPDB2command, use SMTPDB264 instead.

SMTPDB264 also supports the zipping of file attachments.

Note: This command requires a license for the RJS DataExport/400 software for file translation.

SMTPDB264 Command Parameters

From File NameThis parameter holds the name of the AS/400 Database File which will be reformatted and sent inCSV format.

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

Page 35: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 34

© 1995-2002 ... RJS Software Systems Inc.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

Internal File Attachment NameThis parameter allows a file attachment to be renamed inside the email messages.

*AS400FILE is the default setting which will name the internal file attachment based on the AS/400file selected for conversion.

Example:If file name CUSTMAST is selected, the attachment name will be CUSTMAST.CSV.

SMTP Server NameThis parameter holds the SMTP Server Name or the TCP/IP Address of the SMTP Server whereoutgoing email will be forwarded to. Any valid SMTP Server such as the AS/400 SMTP Server,Domino for AS/400 SMTP Server, MS Exchange, Novell Groupwise or other SMTP Server may beused. LOCALHOST can be entered if the AS/400 is the SMTP Server as well.

Attachment File ExtensionThis setting is used internally to set the file extension for the file to be sent if *AS400FILE is used forthe internal file attachment name.

Note: There is no need to change this setting because it will be changed based on the settings listedbelow.

If *TBL is selected for conversion, .TXT will be used for the extension.If *CSV is selected for conversion, .CSV will be used for the extension.If *SV is selected for conversion, .CSV will be used for the extension.If *HTM is selected for conversion, .HTM will be used for the extension.If *XML is selected for conversion, .XML will be used for the extension.

Record DelimiterThis option determines the character sequence that will be placed at the end of each data line todenote a new line of data.

*CRLF - A carriage return/line feed combination is placed at the end of the record. (Default)*LF - A line feed is placed at the end of the record.*CR - A carriage return is placed at the end of the record.*CRLF - A line feed/carriage return combination is placed at the end of the record.

Output last record delimiterThis option determines if the record delimiter value gets output after the last record in the file. In somerare situations, you may want a file created without a record delimiter after the last record in anoutput file.

*YES - Output record delimiter after last record. (Default)*NO - Don't output record delimiter after last record.

Record format of output fileThis option determines which output PC data type to use when the AS/400 file getsconverted.

Page 36: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3835

© 1995-2002 ... RJS Software Systems Inc.

*CSV - Comma Separated Variable. CSV is the most widely used export format. This format can beautomatically opened by MS Excel, MS Access and can be opened or imported by just about any PCsoftware product that has a data import feature. (Default)

*TBL - Fixed Length ASCII Format. Some software packages can only import from a fixed lengthASCII record. The fixed length format is useful when an application must write to a fixed length outputfile because the application that will read the file requires a fixed length format. In general, you shouldattempt to use *CSV instead of fixed length if possible.

*HTM - HTML Table Format. HTML format is an ideal way to publish AS/400 table queries to a website on a daily basis. HTML tables as well as the other formats can be emailed with SMTP/400 toprovide daily email updates to a remote user. The HTML tables can also be published via FTP/400 orbasic AS/400 FTP to any web site. If using the AS/400 web server, the resulting HTML file can besimply converted to an IFS folder and the table file will be immediately available via the AS/400 webserver.

*XML - XML Table Format. XML table format is an ideal way to publish AS/400 table queries to a website or send data to an EDI provider on a regular basis. Users can then create XSL style sheets withtheir favorite HTML editor to allow the XML files to be easily viewed from the web.

Future direction: The future direction for XML output is to be able to publish one or more parent/childrelationships for applications such as sending invoices, orders, etc. where the information isn'tpresented in a single table format. Contact RJS Software Systems if you would like to further discussXML formatting.

*SV - Do not use this format. It is basically the same as *CSV, so use the *CSV format instead.

Field delimiterWhen *CSV is used for the output format, the field delimiter setting determine the value placedbetween each field in the output file. Usually a comma is placed between each record, but someapplications use a different delimiter such as a tab value, tilde - ~, pipe - | etc.

*COMMA - Place a comma between each record.(Default)*BLANK - Place a blank character between each record.*TAB - Place a tab character between each record.Character value - Key any other single character value that you would like to use instead of acomma, blank or tab character.

Output column headingsEnable this setting if you want the first record in the output file to contain column headings.

*YES - Output column headings in first record.*NO - Don't output column headings in first record.(Default)

Output quotes around textEnable this setting if you want all text values to be surrounded with double quotes. Some applicationsrequire quotes to be placed around all text values and some do not.

Example text with double quotes: "This is a test"Example text without double quotes: This is a test

*YES - Output quotes around text. (Default)*NO - Don't output quotes around text.

XML/HTML Report Heading

Page 37: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 36

© 1995-2002 ... RJS Software Systems Inc.

Enter the report/file heading for the selected HTML table report or XML file. This is a descriptive titlethat will be placed in the resulting HTML or XML file as a heading.

XML/XSL Stylesheet URLEnter the URL of the location of the XSL style sheet used to display the XML file when viewed withInternet Explorer. XSL style sheets allow XML to be displayed in a selected table format.

If you are not yet familiar with XSL style sheets, use the Web site listed below or your favorite XMLsite to learn more about XSL style sheets and XML.http://www.xml101.com

HTML Heading Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Heading Foreground Color.

#FFFFFF - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Heading Background ColorThis setting will output the 6 digit color value to be used for the HTML Heading Background Color.

#800000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Text Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Text Foreground Color.

#000000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Text Background ColorThis setting will output the 6 digit color value to be used for the HTML Text Background Color.

#F7EFDE - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

HTML Title Foreground ColorThis setting will output the 6 digit color value to be used for the HTML Title Foreground Color.

#000000 - (Default)

Use the Web site listed below or your favorite HTML editor to determine HTML color values:http://www.rjssoft.com/htmlcolor.htm

Column Heading InfoThis setting determines the format of the column headings if they are output.

*FLDNAME - Output the field name from the AS/400 file being converted. (Default)

Page 38: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3837

© 1995-2002 ... RJS Software Systems Inc.

*COLHDG1 - Output the column heading 1 value from the AS/400 file definition.*COLHDG2 - Output the column heading 2 value from the AS/400 file definition.*COLHDG3 - Output the column heading 3 value from the AS/400 file definition.*FLDTEXT - Output the field text value from the AS/400 file definition.

Compress AttachmentThis setting determines if the file attachment will be compressed with PKZIP compatible compressionbefore sending.

*NO - Attachment is not compressed. (Default)*YES - Attachment is compressed.

Compression PasswordThis setting determines if the file attachment will be compressed with a compression password.

Note: The ZIP password setting does not work unless the ASI PKZIP setting is enabled via theSMTPASIZIP and SMTPZIPLIB commands.

Write Log Entry After EmailingThis parameter tells SMTP/400 to write a log entry to the SMTP/400 History Log File (SMTPLOG00)indicating success or failure of an email message delivery to the outbound SMTP server.

Note: This entry does not tell if the email recipient actually got the message. It simply tells whetherSMTP/400 was able to forward the message for delivery to the specified SMTP server.

1.5.10 Mail Server Framework Commands

The commands listed in the next sections utilize the AS/400 Mail Server Framework APIQtmmSendMail to send mail messages.

The Mail Server Framework was IBM's initial implementation for emailing from the AS/400 and has notbeen improved to this date.

As a general rule of thumb, these commands are old and outdated and should not be used. You shouldnormally utilize the True SMTP Commands.

1.5.11 SMTPMAIL: Send Email Message using Mail Server Framework

The SMTPMAIL command is used to send a text message or an IFS file attachment that containsplain ASCII data.

The SMTPMAIL command uses the AS/400 Mail Server Framework API QtmmSendMail to send themail message.

Note: Typically you should use the SMTPMAIL2 or SMTPSEND commands to send text messagesbecause they send emails via the native SMTP protocol and bypass the AS/400 Mail ServerFramework.

Page 39: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 38

© 1995-2002 ... RJS Software Systems Inc.

SMTPMAIL Command Parameters

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

MessageThis parameter holds the Message text which will be sent in the email message.

ASCII Text File AttachmentThis parameter holds the IFS file attachment name(s). Example: /CUSTORD.TXT This example wouldsend the file CUSTORD.TXT. CUSTORD.TXT is stored in the root directory of the Integrated File System(IFS).

Only one file is currently allowed for attachment.

Page 40: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3839

© 1995-2002 ... RJS Software Systems Inc.

1.5.12 SMTPDB: Send AS/400 Database using Mail Server Framework

The SMTPDB command is used to reformat and send any AS/400 database member formatted as anASCII Comma Separated Variable (CSV) file attachment. CSV is a standard interchange format thatcan be read by MS Excel, Access and many other PC applications.

The SMTPDB command uses the AS/400 Mail Server Framework API QtmmSendMail to send the mailmessage.

Note: Typically you should use the SMTPDB2 or SMTPDB264 commands because they send emailsvia the native SMTP protocol and bypass the AS/400 Mail Server Framework.

SMTPDB Command Parameters

From File NameThis parameter holds the name of the AS/400 Database File which will be reformatted and sent inCSV format.

To Email AddressThis parameter holds the To Email Address where the message will be sent.

From Email AddressThis parameter holds the From Email Address of the person sending the email message. If the emailbounces back for any reason it should get automatically delivered back to the From Email Address bythe mail system. This is dependent on your email system and its capabilities.

SubjectThis parameter holds the Subject of the email message.

Page 41: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 40

© 1995-2002 ... RJS Software Systems Inc.

MessageThis parameter holds the Message text which will be sent in the email message.

Page 42: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3841

© 1995-2002 ... RJS Software Systems Inc.

1.6 Programming Samples

1.6.1 SMTPTEXT CL/RPG SampleThe sample programs listed below contain a CL program and an ILE RPG program tocreate a text message and email the message from the AS/400 using the SMTPTEXTcommand.

------Begining of CL Sample Program ------

PGM

/***************************************************************/ /* GO TO ERROR HANDLER IF ERRORS OCCUR */ /***************************************************************/ MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))

/***************************************************************/ /* CREATE TEMPORARY AS/400 FILE TO HOLD MESSAGE TEXT */ /* CLEAR THE MEMBER TO MAKE SURE WE'RE READY TO GO */ /***************************************************************/ CRTPF FILE(QTEMP/SMTPMSG) RCDLEN(512) + OPTION(*NOLIST *NOSRC) MAXMBRS(*NOMAX) MONMSG MSGID(CPF0000)

/***************************************************************/ /* RUN RPG PROGRAM TO CREATE TEXT MESSAGE IN FILE */ /***************************************************************/ OVRDBF FILE(SMTPMSG) TOFILE(QTEMP/SMTPMSG) CALL PGM(TESTTEXT1R) DLTOVR FILE(SMTPMSG)

/***************************************************************/ /* CALL SMTPTEXT TO SEND THE TEXT MESSAGE */ /* AUTOMATICALLY CLEAR THE WORK FILE AFTER EMAILING */ /***************************************************************/ SMTPTEXT TOADDR([email protected]) FROMADDR(*DEFAULT) + SUBJECT('This is a test text message') + MSGFILE(SMTPMSG) MBR(*FIRST) CLRMBR(*YES) + SMTPHOST(*DEFAULT) CONTYPE('text/plain')

RETURN

/********************************************************************/ /* HANDLE ERRORS */ /********************************************************************/ ERRORS:

/* SEND EXIT MESSAGE ON ERROR */ SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Errors + occurred while creating email') + MSGTYPE(*ESCAPE) ENDPGM

------ End of CL Sample Program ------

------ Beginning of RPG Sample Program ------

H*****************************************************************H* Program descriptionH*H* This program will write a test message to a physical file.

Page 43: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 42

© 1995-2002 ... RJS Software Systems Inc.

H* The text message will be later emailed using the SMTPTEXTH* CL command.H*H* Copyright (c) 2001 RJS Software Systems Inc.H* ALL RIGHTS RESERVEDH*****************************************************************Hcopyright('Copyright RJS Software Systems. 2001')FSMTPMSG IF A F 512 DISK INFDS(INP1DS)D*****************************************************************D* INPUT DATA STRUCTURED*****************************************************************D INP1DS DSD $$RRN1 397 400B 0D*****************************************************************D* WORK FIELDS AND CONSTANTSD*****************************************************************D CRLF S 2A Inz(X'0D25')D NewLine S 2A Inz(X'25')D Null S 1A Inz(X'00')D PageBreak S 1A Inz(X'0C')D MsgText S 512AD Count S 5P 0D*****************************************************************C* MAIN LINE CALCULATIONSC*****************************************************************

C*** Write Page Number 2C Eval MsgText = 'Page 1'C Except $WriteMsg

C*** Write Initial Text LineC Eval MsgText = 'This is a long text ' +C 'message illustrating how to ' +C 'create a text line in RPG 'C Except $WriteMsg

C*** Use a loop to write 10 text linesC Eval count = 0C DoW count <= 10C Eval MsgText = 'This is a text line'C Except $WriteMsgC Eval Count = Count + 1C Enddo

C*** Write a Page BreakC*** Note: Not all PC mail clients will recognize page breaksC*** in multi-page text messages.C Eval MsgText = PageBreak + CRLFC Except $WriteMsg

C*** Write Page Break MessageC Eval MsgText = 'A page break was written ' +C 'above. Not all mail clients will ' +C 'recognize page breaks'C Except $WriteMsg

C*** Write Page Number 2C Eval MsgText = 'Page 2'C Except $WriteMsg

C*** Write a URLC Eval MsgText = 'Web Link to SMTP/400:'

Page 44: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3843

© 1995-2002 ... RJS Software Systems Inc.

C Except $WriteMsgC Eval MsgText = 'http://www.rjssoft.com/' +C 'smtp400.htm'C Except $WriteMsg

C*** Write a Blank LineC Eval MsgText = ' 'C Except $WriteMsg

C*** Use a loop to write another 10 text linesC Eval count = 0C DoW count <= 10C Eval MsgText = 'This is a text line'C Except $WriteMsgC Eval Count = Count + 1C EnddoC*** Return to callerC Exit TagC EXSR ExitProgramC*****************************************************************C* SUBROUTINE - ExitProgram *C* PURPOSE - Exit from the program *C*******************************************************************CSR ExitProgram BEGSRC EVAL *INLR = *ONC RETURNC ENDSRO*******************************************************************O* Message Output to Message MemberO*******************************************************************OSMTPMSG EADD $WriteMsgO MsgText 512

------ End of RPG Sample Program ------

1.7 Problem Handling

1.7.1 Common Errors

If errors occur while running the SMTP/400 Email API's, always make sure to check the AS/400 joblog by using the DSPJOBLOG command from the AS/400 command line. Many times the job log willgive some idea as to what is failing.

When using LOCALHOST as the SMTP Server name for any of the AS/400 commands, the AS/400SMTP Server or Domino for AS/400 SMTP Server must be running.

When using the SMTPMAIL or SMTPDB command from the AS/400, the AS/400 Mail ServerFramework must be active.

NOTE: The Mail Server Framework based commands SMTPMAIL and SMTPDB commands areoutdated and should not be used. Use the SMTPMAIL2 or SMTPDB2 commands instead since thesecommands use true SMTP for sending email messages. True SMTP is much more reliable than theMail Server Framework based commands.

Page 45: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 44

© 1995-2002 ... RJS Software Systems Inc.

1.7.2 SMTP Command Return Codes

The following return codes from the Native SMTP API commands should give some indication of whatthe problem might be:

00001 - Unable to create SMTP signal handler. This error can also occur if the native AS/400 reportconverter cannot open an IFS output file when converting a report. If you have this problem, youeither have an IFS security problem or you may need to talk to RJS Software Systems.

00002 - SMTP mail host could not be found. Check to make sure you're using a valid SMTP serverhost name from the AS/400 host table or your DNS server. Do not use an IP address for the SMTPhost name. This problem can also be caused if your SMTP server is not available. If you cannot PINGyour SMTP server host name, you will need to talk to your network support people to make sure yourSMTP server is operational.

00003 - Temporary message input IFS file could not be opened from the IFS. If you have thisproblem, you will need to talk to RJS Software Systems to determine the cause.

00004 - Temporary message input IFS file was zero bytes. If you have this problem, you will need totalk to RJS Software Systems to determine the cause.

00005 - Unable to open TCP/IP socket. If you have this problem, you will need to talk to RJSSoftware Systems to determine the cause.

00006 - Unable to connect to SMTP server. Check to make sure you're using a valid SMTP serverhost name from the AS/400 host table or your DNS server. Do not use an IP address for the SMTPhost name. This problem can also be caused if your SMTP server is not available. If you cannot PINGyour SMTP server host name, you will need to talk to your network support people to make sure yourSMTP server is operational.

00007 - Error writing HELO SMTP directive to SMTP server. It's possible you're not connecting to avalid SMTP server. If you have this problem, you will need to talk to your network support people tomake sure your SMTP server is operational.

00008 - Error writing MAIL FROM directive to SMTP server. It's possible you're not connecting to avalid SMTP server, this SMTP server does not accept mail relaying or an invalid FROM emailaddress was passed. Email addresses should not be passed with brackets (<>) around them. If youcontinue to have this problem after checking the FROM email address, you will need to talk to yournetwork support people to determine if mail relaying is allowed for your SMTP server.

00009 - Error writing RCPT TO directive to SMTP server. It's possible you're not connecting to a validSMTP server, this SMTP server does not accept mail relaying or an invalid TO email address waspassed. Email addresses should not be passed with brackets (<>) around them. If you continue tohave this problem after checking the TO email address, you will need to talk to your network supportpeople to determine if mail relaying is allowed for your SMTP server.

00010 - Error occurred while writing email message DATA directive to SMTP server. You may havebeen abnormally disconnected from your SMTP server while sending an email message or you arenot allowed to send email to this SMTP server. Try disconnecting and sending the email messageagain.

00011 - Error occurred while writing email message data to SMTP server. You may have beenabnormally disconnected from your SMTP server while sending an email message or you are notallowed to send email to this SMTP server. Try disconnecting and sending the email message again.

Page 46: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3845

© 1995-2002 ... RJS Software Systems Inc.

00012 - Error occurred while writing end of email message data (.) directive to SMTP server. Youmay have been abnormally disconnected from your SMTP server while sending an email message oryou are not allowed to send email to this SMTP server. Try disconnecting and sending the emailmessage again.

00013 - Error occurred while writing email message QUIT directive to SMTP server. You may havebeen abnormally disconnected from your SMTP server while sending an email message or you arenot allowed to send email to this SMTP server. Try disconnecting and sending the email messageagain.

00017 - Invalid response (not a 250) was received from your SMTP server after sending the HELOSMTP directive. It's possible you're not connecting to a valid SMTP server. If you have this problem,you will need to talk to your network support people to make sure your SMTP server is operational orRJS Software Systems to determine the cause.

00018 - Invalid response (not a 250) was received from your SMTP server after sending the MAILFROM directive. It's possible you're not connecting to a valid SMTP server, this SMTP server doesnot accept mail relaying or an invalid FROM email address was passed. If you continue to have thisproblem after checking the FROM email address, you will need to talk to your network support peopleto determine if mail relaying is allowed for your SMTP server.

00019 - Invalid response (not a 250) was received from your SMTP server after sending the RCPTTO directive. It's possible you're not connecting to a valid SMTP server, this SMTP server does notaccept mail relaying or an invalid TO email address was passed. If you continue to have this problemafter checking the TO email address, you will need to talk to your network support people to determineif mail relaying is allowed for your SMTP server.

00020 - Message was not accepted for delivery by the SMTP server. You may have been abnormallydisconnected from your SMTP server while sending an email message or you are not allowed to sendemail to this SMTP server. Try disconnecting and sending the email message again.

00021 - Authentication error when logging into SMTP server for authenticated SMTP. You may havebeen abnormally disconnected from your SMTP server while sending an email message or you arenot allowed to send email to this SMTP server using SMTP authentication. Typically MS Exchange isthe mail server being used if this error occurs.

00022 - Invalid response (not a 334) was received from your SMTP server after sending the AUTHLOGIN directive. It's possible you're not connecting to a valid SMTP server or this SMTP server doesnot accept authenticated connections. If you continue to have this problem, you will need to talk toyour network support people to determine if authenticated SMTP is supported on your mail server.Typically MS Exchange is the mail server being used if this error occurs.

00023 - Authentication error when logging into SMTP server for authenticated SMTP. You may havebeen abnormally disconnected from your SMTP server while sending an email message or you arenot allowed to send email to this SMTP server using SMTP authentication. Typically MS Exchange isthe mail server being used if this error occurs.

00024 - Invalid response (not a 334) was received from your SMTP server after sending the USERIDto the mail server. It's possible you're not connecting to a valid SMTP server or this SMTP serverdoes not accept authenticated connections. Your SMTP user ID and password may also not beentered correctly. If you continue to have this problem, you will need to talk to your network supportpeople to determine if authenticated SMTP is supported on your mail server. Typically MS Exchangeis the mail server being used if this error occurs.

00025 - Authentication error when logging into SMTP server for authenticated SMTP. You may have

Page 47: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API 46

© 1995-2002 ... RJS Software Systems Inc.

been abnormally disconnected from your SMTP server while sending an email message or you arenot allowed to send email to this SMTP server using SMTP authentication. Typically MS Exchange isthe mail server being used if this error occurs.

00026 - Invalid response (not a 235) was received from your SMTP server after sending thePASSWORD to the mail server. It's possible you're not connecting to a valid SMTP server or thisSMTP server does not accept authenticated connections. Your SMTP user ID and password mayalso not be entered correctly. If you continue to have this problem, you will need to talk to yournetwork support people to determine if authenticated SMTP is supported on your mail server.Typically MS Exchange is the mail server being used if this error occurs.

1.7.3 Sending SMTP Message via Telnet

The following steps can be used from the AS/400 to test to see if a SMTP email server can correctly send emailmessages. This is the best way to troubleshoot whether you can connect and send message via your SMTP mailserver.

Usually the problem will turn out to be that the SMTP server is not set up to accept mail relaying. (Email passedfrom one SMTP server to another) When running the SMTP commands listed below you will receive an errorresponse message if mail relaying is not allowed.

1.) Type the following command from the AS/400 command line. This will connect you to your SMTP mail serverso that you can manually send a mail message:

TELNET RMTSYS(RJS) PORT(25)

**Note: In this sample we used a host name of RJS. You should use the host name for your SMTP mailserver.

After typing the TELNET command and pressing Enter, you should see a 220 message similar to the followingmessage if you get connected to your SMTP server:

220 RJSSOFT.COM ESMTP Service

2.) Type the following commands individually and press Enter after each one. This will send a one line emailmessage that says: "TEST EMAIL".

**Note: Where we used [email protected], you sould use your own Internet email address.

--------------------------------------------------------------------------------------------------------------------

HELO [email protected] (Note: With the AS/400, sometimes the HELO command has to be types 2-3times. Odd but it works.)

MAIL FROM: [email protected] (This option tells the SMTP server who is sending the email message.)

RCPT TO: [email protected] (This option tells the SMTP server who the email recipient will be.)

DATA (This option tells the SMTP server we're about to send data)

TEST EMAIL

. (Yes this is a period. After pressing Enter, your message should be sent)

QUIT (This option closes the SMTP session)

Page 48: SMTP/400 Email API - V1 - RJS Support Center

SMTP/400 Email API - V1.3847

© 1995-2002 ... RJS Software Systems Inc.

1.7.4 Other Errors

If you cannot resolve the problem you're experiencing by using the previous troubleshooting methods,you should contact RJS Software Systems for advice on solving the problems you're experiencing.