Setting the email address for a user profile

User profiles and email addresses

If you need help with any of the techniques described below, feel free to contact our support team.

Where does CoolSpools get the email address for a user profile from?

By default, CoolSpools uses the email address information stored for a user in the system i system directory.

When you specify the default value FROM(*CURRENT) on the SNDCMNMSG command, or EMAILFROM(*CURRENT) on CVTSPLPDF, CVTDBFXL etc., CoolSpools will look up the user profile running the command in the system i system directory and use the information stored there to obtain both the email address and the name of the user in question.

If no email address is defined for a user profile in the system directory, CoolSpools will attempt to construct a "dummy" email address from the other information available to it (e.g. user profile name, system domain name). This may result in an email address that is rejected by email servers. We therefore encourage you to either specify a valid email address explicitly on the FROM and EMAILFROM parameters, or to ensure that all users who will send emails have valid email addresses defined in the system directory.

The system directory can be managed using the following IBM i (OS/400) commands:

  • WRKDIRE (Work with directory entries)
  • ADDDIRE, CHGDIRE, RMVDIRE (Add, Change, Remove Directory Entry)
  • WRKNAMSMTP (Work with Names for SMTP - this manages just the email address information

Each user defined in the system directory must be assigned a two part name consisting of:

  • User ID

    Note that this can be a maximum of 8 characters in length, so if your user profile name is 9 or more characters in length, a shortened name will need to be used for the user ID part of the corresponding system directory entry name.

  • Address

    This is typically the system name or something identifying the machine. This is intended to distinguish between users with the same ID on different systems.

When defining a user in the system directory, note that you need to press F19=Change name for SMTP to work with the user's SMTP (email) details:


                             Change Directory Entry                             
                                                                                
 User ID/Address . . . . :   ARIADNE   ARIADNE1                                 
                                                                                
 Type changes, press Enter.                                                     
                                                                                
   Description . . . . . .   ariadne software                                   
   System name/Group . . .   ARIADNE1               F4 for list                 
   User profile  . . . . .   ARIADNE                F4 for list                 
   Network user ID . . . .   ARIADNE  ARIADNE1                                  
                                                                                
   Name:                                                                        
     Last  . . . . . . . .   software                                           
     First . . . . . . . .   ariadne                                            
     Middle  . . . . . . .                                                      
     Preferred . . . . . .   ariadne software                                   
     Full  . . . . . . . .   ariadne software ltd.                              
                                                                                
                                                                                
                                                                                
                                                                        More... 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F18=Display location details   
 F19=Change name for SMTP   F20=Specify user-defined fields   F24=More keys     

The email address is defined in two parts:

  • SMTP user ID

    This is the part of the email address preceding the @

  • SMTP domain

    This is the part of the email address following the @

Thus the email address associated with user ARIADNE ARIADNE1 below is support@ariadnesoftware.co.uk.


                              Change Name for SMTP                              
                                                             System:   ARIADNE1 
 User ID/Address . . . . . :   ARIADNE  ARIADNE1                                
                                                                                
                                                                                
                                                                                
 Type choices, press Enter.                                                     
                                                                                
   SMTP user ID  . . . . . .   support                                          
   SMTP domain . . . . . . .   ARIADNESOFTWARE.CO.UK                            
                                                                                
                                                                                
                                                                                
                                                                                
   SMTP route  . . . . . . .                                                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
 F3=Exit   F12=Cancel                                                           

If you have a large number of user profiles and you need to define email addresses for all of them, do this job manually can be laborious.

it is possible to do this job programmatically if you have:

  • a list of user profiles for whom email addresses need to be defined
  • some means of determining the email address in each case, for example a lookup table or strict naming convention

The source of a skeleton program called CM_SYSDIRR is provided in source file CM_SRCFILE in library COOLSPV6R1. The program demonstrates how yo might set up email addresses programmatically for a list of users created with the WRKUSRPRF ... OUTPUT(*OUTFILE) command.