I was asked is it possible for each person who sends email using the Send SMTP Email command, SNDSMTPEMM , to have their own unique email address. This command is used to send SMTP emails from IBM i. I am not going to go into details on how to use and configure your IBM i, I am going to refer you to the following posts:

When writing this post I had to use a Security Officer, *SECOFR , equivalent user profile to do what I needed to do. I do not have an System Operator, *SYSOPR , equivalent profile, therefore, I do not know if that gives you the necessary changes I will describe below.

Let me also say that before you make any of these changes you need to get the OK from the person who is responsible for the IBM i partition you will be making these changes on.

To be able to have a SMTP email address the user needs to have a System Directory Entry. If they do not you need to add them. This posts describes how to add a user to the System Directory Entry. In this example my Programmer user profile has already been added to the System Directory.

I need to work with my entry, I do so using the Work With Directory Entries command, WRKDIRE . I need to pass two parameters to the command:

User profile. In this example the user profile is "SIMON". Address. 99% of the time this is the same name as IBM i partition. In this example the name of the address is "SYSTEM1".

WRKDIRE USRID(SIMON SYSTEM1)

When I press Enter and the Work with Directories Entries screen is displayed with just the entry for this profile and address. I am not going to bother to show this screen as all I need to do is just put a "2" next to the entry and press Enter.

The Change Directory Entry screen is displayed. Here I need to press F19 to "Change name for SMTP".

As I have not done this before I get the following message at the bottom of my screen:

User ID/address does not exist in SMTP table. Press Enter to add, F12 to ...

As it says I press Enter as I want to add, and the Add Name for SMTP screen is displayed:

Add Name for SMTP Type choices, press Enter. User ID . . . . . . . . : SIMON Address . . . . . . . . : SYSTEM1 SMTP user ID . . . . . . SMTP domain . . . . . . . SMTP route . . . . . . . F3=Exit F4=Prompt F12=Cancel

On this screen I just need to fill in the first two fields. The SMTP route field must be left blank.

SMTP user id : The name I want to come before the @ sign in the email address. SMTP domain : The name of the domain I want the email to come from.

Add Name for SMTP Type choices, press Enter. User ID . . . . . . . . : SIMON Address . . . . . . . . : SYSTEM1 SMTP user ID . . . . . . the_man SMTP domain . . . . . . . system1.com

And press Enter. I am returned to the previous screen, Change Directory Entry, and the following message is displayed at the bottom of the screen:

SMTP table updates pending. Press Enter to update.

I press Enter and my changes are saved.

Now I send myself an email:

SNDSMTPEMM RCP((SIMON@RPGPGM.COM)) SUBJECT('This is a test') NOTE(TEST)

I receive this:

From: the_man@system1.com To: simon@rpgpgm.com Date: DD/DD/DDDD TT:TT PM Subject: This is a test TEST

If I want to remove the SMTP settings I put a "2" next to my entry. When I am back in the Change Directory Entry screen I press F22, "Remove name for SMTP". On the confirmation screen I press Enter to remove the entries I added previously. When I am back at the Change Directory Entry screen I have to press Enter again to confirm the change.

This article was written for IBM i 7.4, and should work for some earlier releases too.