29
Fri, Nov
0 New Articles

A SNADS/SMTP Bridge

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Email Bridges to the 21st Century

SNA Distribution Services (SNADS) is the email engine of Advanced Program- to-Program (APPC), allowing messages and files to be transported through the Advanced Peer-to-Peer Networking (APPN) network. Simple Mail Transfer Protocol (SMTP) is the Internet equivalent, available to Microsoft’s Internet Information Server, Microsoft’s Exchange Server, Lotus Notes, cc:Mail, and a growing number of email systems. The question facing many AS/400 SNADS administrators is a simple one: How can the AS/400 swap mail with these Internet-capable post offices? The answer is a SNADS/SMTP bridge. In this article, I’ll show you the step-by-step process of building this bridge.

A Little Background Music, Please

Starting with V3R1 of OS/400, mail-related processing on the AS/400 was rewritten to use a new tool called the AnyMail/400 Mail Server Framework (MSF). The MSF is an extendible set of routines tied to the Work Management function of OS/400. MSF provides exit points and APIs that allow separate programs to process and route mail messages and file attachments. Starting with V3R1, SNADS on the AS/400 was rewritten to use the MSF.

At the same time, OS/400 was provided with SMTP. It too uses the MSF to process messages. To create a SNADS/SMTP bridge, we’ll connect the services of SNADS and SMTP through the MSF using various specialized SNADS directory entries and SMTP alias configuration tables. The process takes only about 25 minutes of configuration, and no custom coding is required.

Is SMTP Loaded on the AS/400?


The first step is to ascertain that SMTP has been loaded on the AS/400. SMTP runs in the QSYSWRK subsystem, so the steps for finding it are simple. At an OS/400 command line type DSPSBSD *QSYSWRK. Select option 7 to display the routing entries contained in the QSYSWRK subsystem. What you will be looking for is a routing entry associated with the QCMD program with a Compare Value of SMTPROUT. The screen will look like the one shown in Figure 1. This indicates that SMTP is loaded on your system. If it’s not there, you’ll need to talk to IBM Support to see what PTFs you’ll need to get to a supportable level of OS/400.

Creating a SNADS/SMTP Distribution Queue

Next, you’ll need to create a distribution queue to send information between SNADS and SMTP. To accomplish this, branch to the main SMTP menu on the AS/400 by keying the Configure TCP SMTP (CFGTCPSMTP) command and pressing Enter. Then, select option 12 to configure your distribution services. At the submenu, select the option labeled 1=Distribution queues. This will display the Configure Distribution Queues screen, showing all of the distribution queues that have been created for your AS/400. To add a distribution queue, press the F6 key. This will bring up a prompt that looks like Figure 2.

The queue you’re creating is not a normal SNADS distribution queue, but one that is unique to SMTP. The distribution queue name must be QSMTPQ, and the type of queue must be *RPDS, which stands for Remote Process Distribution Services. Make the Remote location name TCPIPLOC and the APPC mode parameter *NETATR. The remote net ID should be *LOC, as should the local location name. Press Enter and a new distribution queue will be created.

Now, you’ll need to create a routing table entry to provide a conduit to the QSMTPQ distribution queue. By pressing F12 from the Configure Distribution Queues screen, you’ll be returned to the previously mentioned Distribution Services submenu. This time, select option 2=Routing table. This will display the Configure Routing Table screen. Again, press F6 to create a new routing table. In the System name/Group parameter field, key in TCPIP. Add a description, as shown in Figure 3. In the parameters under Service level, key QSMTPQ into each of the Queue name parameters. There should be four Queue name parms. Press Enter to add this new entry, and then press F12 to exit.

Beyond Queues and Routing Tables

You now have a basic mechanism for passing mail to SMTP: a distribution queue named QSMTPQ and a routing table connecting to it called TCPIP. What you need now is a means of sending your mail out of SNADS and directing it to this new QSMTPQ distribution queue. You’ll create that mechanism by using the SNADS directory.

In SNADS, every mail recipient must have a directory entry that references both a unique user ID and a user address. This is the same idea as an address book. In our example, you’ll want to set up in the SNADS Directory a new entry that will direct SNADS mail to the QSMTPQ.

At the Configure TCP SMTP menu, option 10 allows you to work with the SNADS directory entries. Here, add a new directory entry by placing a 1 in the OPT field of the Work With Directory Entries display and pressing Enter. Key in the user ID as *ANY and the user address as TCPHOST, as shown in Figure 4. By using the reserved word *ANY, you’re telling SNADS to use this directory entry for any mail the sender transmits to an address of TCPHOST. In other words, you want all mail that is destined for SMTP to pass through this single directory entry.


Key in an appropriate description for this directory entry, and then—most importantly—key TCPIP into the System name/Group parameter. As you’ll recall, TCPIP is the name of the routing table entry we created in the previous step. Press the Enter key, and your SNADS setup is complete.

A Rose by Any Other Name . . . Is an Alias

Now, you have a directory entry that allows your SNADS users to address mail (*ANY at TCPHOST), a routing table that intercepts and directs the mail (TCPIP), and a distribution queue that holds the mail until OS/400 sends it out the door.

But how, you may be asking, are the SMTP mail addresses (such as This email address is being protected from spambots. You need JavaScript enabled to view it.) mapped from the *ANY TCPHOST directory entry identified for SNADS? The answer lies in the AS/400’s implementation of alias tables.

On the AS/400, an alias table is a cross-reference list that associates SNADS directory entries with SMTP user IDs and SMTP domain names. There are two types of alias tables on the AS/400: a system alias table that is available to all users and a personal alias table that is available to only the current sender.

When the OS/400 MSF processes the mail sent to the QSMTPQ distribution queue, the TCPIP routing table we’ve just created tells it that this mail is destined for an *RPDS. The MSF then looks first to the user’s personal alias table to find an appropriate SMTP association and—if none is found—looks in the system alias table for an entry. When it finds a SNADS user ID and address that matches, it substitutes the SMTP user ID and the SMTP domain name. Finally, the MSF passes the resolved name and address onto the SMTP server program, which sends it out the door across the TCP/IP network.

To create an alias table entry, use option 1, Work with system alias table, or option 2, Work with personal alias table, from the Configure TCP SMTP menu. A sample alias table entry is shown in Figure 5.

Note that the SMTP user ID can be up to 24 characters in length, while the original SNADS user ID is limited to eight characters. This is the address translation that allows you to send mail to users on remote systems whose names exceed the SNADS limitation of eight characters. Second, note that SMTP domain names can be considerably longer—up to 255 characters in length. Keep in mind that the entire length of the address—SMTP user ID and SMTP domain combined—can be no longer than 255 characters.

Here, as in the SNADS directory entry, you could create an alias that maps all SNADS users to a single SMTP address if you wanted. To accomplish this, you’d enter a SNADS user ID/address of *ANY TCPHOST. You might want to create such an address and associate it with an SMTP address of postmaster@domain_name, so that the administrator on the SMTP host could sort through any unresolved addresses.

Finally, note the SMTP route field. You might want to use this field to set up a routing path on the TCP/IP network in order to get the mail to the appropriate TCP mail server.

The SMTP domain name is by far the most important piece of information in the alias table because it is used to route mail both to and from the SMTP host. This domain name must match the local domain and host name entries established for the TCP/IP protocol description. Otherwise, the SMTP server program will choke when it starts to process SNADS distributions.

Verifying Your Domain and Host Names


To verify that your alias table entries are using the correct domain name for the AS/400, you need to go to the Configure TCP menu. Do this by typing CFGTCP on an OS/400 command line and pressing Enter. Select option 12, Change local domain and host name. See Figure 6 to see a typical setup.

SMTP uses a concatenation of host name and domain name to find the associated mail recipients. So, if I’m sending mail through SNADS from my AS/400—which has a host name of MCEDIT and a domain name of midrangecomputing.com—my address in the alias table should be userid@ mcedit.midrangecomputing.com.

SMTP Server Start-up Parameters

No doubt, you’ll want to modify how SMTP is started and how often it sends mail out of the QSMTPQ distribution queue. To do this, key in CHGSMTPA and press Enter. You’ll be presented with a screen that controls the SMTP server program’s start-up program.

If you want the SMTP server program to be automatically loaded each time the TCP services are started, change the Autostart parameter to *YES. Here also is a spot to control how often SMTP will send or retry a mailing; this is shown in Figure 7.

Finally, to actually start SMTP for the first time, you’ll need to restart the AnyMail MSF. To do this, key in ENDMSF and press Enter. As soon as OS/400 tells you that the MSF has successfully ended, restart MSF by keying in STRMSF and pressing Enter. You should be warned, however, that ending MSF also automatically disables the entire SNADS system, interrupting the transfer of all distributions to and from your AS/400. Before you end and restart MSF, you should be certain that your users are aware that you will be tampering with their mail service for a short while.

After MSF has been restarted, you’ll want to start up the SMTP server and run a test. Key in STRTCPSVR *SMTP and press Enter. If your configuration is solid, SMTP should start without error. Look in the QSYSOPR message queue to be certain that it didn’t abort. If, for some reason, things didn’t go so smoothly, you’ll find a job log with appropriate error codes in the QEZJOBLOG outque.

Testing the Bridge

Testing the SNADS/SMTP bridge is pretty simple. Even if you don’t have OfficeVision, you can key in SNDDST and press F4. A sample display is shown in Figure 8. If your alias tables are configured properly and the SMTP server is started, you should be able to send a SNADS message to a person on the other side of the bridge. Figure 9 shows how the message is received by the Windows 95 Exchange Internet Mail client.

Some Final Thoughts

Iif you have trouble sending mail back across the bridge to SNADS, chances are the domain name and host name of your AS/400 are not known to your remote name server or your PC’s LMHOSTs file. Check again to make certain your alias tables are correctly concatenating your SNADS user ID and system name. This can take some time to debug.

SMTP on the AS/400 is a powerful tool. If you’re wondering how to get Internet mail to and from your SNADS users, a SNADS/SMTP bridge is the most cost- effective means. Best of all, it’s free on version 3 of OS/400.


A_SNADS-_SMTP_Bridge05-00.jpg 450x350

Figure 1: Confirming SMTP in the QSYSWRK Subsystem Figure 2: Creating an SMTP Distribution Queue


A_SNADS-_SMTP_Bridge05-01.jpg 450x350

A_SNADS-_SMTP_Bridge06-00.jpg 450x350

Figure 3: Add Routing Table Entry Figure 4: Adding SNADS Directory Entry


A_SNADS-_SMTP_Bridge06-01.jpg 450x350

A_SNADS-_SMTP_Bridge07-00.jpg 450x350

Figure 5: A Sample Alias Table Entry Figure 6: Host and Domain Names on the AS/400


A_SNADS-_SMTP_Bridge07-01.jpg 450x350

A_SNADS-_SMTP_Bridge08-00.jpg 450x350

Figure 7: SMTP Configuration Figure 8: Sending a Simple *MSG with SNADS


A_SNADS-_SMTP_Bridge08-01.jpg 450x350

A_SNADS-_SMTP_Bridge09-00.jpg 450x341

Figure 9: Receiving a SNADS *MSG in Microsoft Exchange


Thomas Stockwell

Thomas M. Stockwell is an independent IT analyst and writer. He is the former Editor in Chief of MC Press Online and Midrange Computing magazine and has over 20 years of experience as a programmer, systems engineer, IT director, industry analyst, author, speaker, consultant, and editor.  

 

Tom works from his home in the Napa Valley in California. He can be reached at ITincendiary.com.

 

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: