Wednesday, March 25, 2020

Customizing email address for SNDSMTPEMM

giving each snsmtpemm user their own email address

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:

  1. User profile. In this example the user profile is "SIMON".
  2. Address. 99% of the time this is the same name as IBM i partition. In this example the name of the address is "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.

  1. SMTP user id:  The name I want to come before the @ sign in the email address.
  2. 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 . . . . . . .                   

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:

             SUBJECT('This is a test')

I receive this:

Subject: This is a 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.


  1. Hi Simon,

    The requirements to have a the user registered in the System Directory Entry depends on the settings for the SMTP attributes. If you use the old settings CHGSMTPA DIRTYPE(*SDD) you need the entry, but if you use the newer settings DIRTYPE(*SMTPMSF) or DIRTYPE(*SMTP) you do not need a System Directory Enrty.
    I prefer DIRTYPE(*SMTP) as you do not use the old MSF(Mail Server Framework) either.

    Regards Krister Karlsson

  2. Good post, Thank you

  3. Hi Simon/Oskarink,
    The old (legacy) SNDDST command was on the back of the fact that SMTPA only had one parm for DIRTYPE. I guess that going forward, SNDSMTPEMM is the command to use and that necessitates the new types available since V7R2 (*SMTP & *SMTPMSF). I believe this parm can be changed from *SDD but if you have legacy procs using SNDDST then you will need entries to be retained in the System Directory as well as ADDSMTPUSR for the SNDSMTPEMM to work.

  4. Hi
    Let me add my 2 pences regarding this command using:
    On my V7R4 it still looks not fully developed and not fully fixed from bugs -
    First of all it has not well developed monitor ability for email sent
    ( of course I've done QZMF journaling before ):

    1) To track after the email sent via SNDSMTPEMM I am using WRMSMTPEMM cmd
    which has a lot of bugs for selecting email logs after filling parameters and what's more worse the log created after every sending email via
    SNDSMTPEMM are suddenly disappeared after some seconds
    2) Despite the WRKDIRE existing is command SMTPUSRADD - and remains question
    what's it is need for then ?
    3) Inside the WRKSMTPEMM command I've found calls to other commands SMTP user maintenance commands that failed during attempt to call them because cannot they cannot be found in library list


To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.