Create Your Own "Out Of Office" Agent

The formula code can be seen below which can be copy and pasted. The agent trigger should be set to "If New Mail...

Has Arrived". A person will only receive one out of office notification during a vacation period if multiple emails are sent. WORKS GREAT! But, if you plan to roll agent out to several people in your company change the trigger to "On Schedule Daily" and acting on "All new and modified documents since last run" to minimize server load during peak hours. REM; REM "Out of Office (OOO)"; REM "Coded by Lance Zakin -"; REM; REM "INSTRUCTIONS"; REM "1. Modify 4 field values below before leaving for vacation and save agent."; REM "2. Enable agent (Select agent checkbox)."; REM; REM "LeaveDate: First day out on vacation. i.e. @Date( year ; month ; day )"; REM "ReturnDate: First day back at work. i.e. @Date( year ; month ; day )"; REM "IntranetMsg: Message displayed to people inside company."; REM "InternetMsg: Message displayed to people outside company from common domain types .com, .edu, .mil, .gov"; REM; LeaveDate := @Date(2000; 3; 10); ReturnDate := @Date(2000; 3; 12); IntranetMsg := "I will respond to your message when I return. If this is an emergency I can be paged at 917-555-1212."; InternetMsg := "I will respond to your message when I return. If this is an emergency I can be paged from web site using pin number 5165551212."; REM; REM "Do not change code below."; REM; @If(@Today >= ReturnDate & Subject != "DISABLE OOO AGENT"; @Do(@MailSend(@UserName; ""; ""; "DISABLE OOO AGENT"; ""; ""); @Return("")); ""); @If(DeliveredDate >= LeaveDate; ""; @Return("")); ProfileDate := @GetProfileField("OOO"; "Date") ; @If(ProfileDate = LeaveDate; ""; @Do(@SetProfileField("OOO"; "Date"; LeaveDate); @SetProfileField("OOO"; "AlreadyNotified"; ""))); ProfileNotified := @GetProfileField("OOO"; "AlreadyNotified") ; @If(@IsMember(From; ProfileNotified); @Return(""); ""); @SetProfileField("OOO"; "AlreadyNotified"; From : ProfileNotified); CR := @NewLine; Message := @If(@Contains(@LowerCase(SMTPOriginator); ".com" : ".gov" : ".net" : ".edu" : ".mil"); InternetMsg; IntranetMsg); Subject := @Name([CN]; @UserName) + " is out of the office."; Remark := "I will be out of the office from " + @Text(LeaveDate ) + " until " + @Text(ReturnDate ) + "." + CR + CR + Message; @MailSend(From; ""; ""; Subject; Remark; "");

This was first published in November 2000

Dig Deeper



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...