Wednesday, July 22, 2015

PeopleSoft Enterprise Software & Documentation

Sending email through SQR is a common requirement. The command should be used for sending emails depends on which Environment your SQR is going to run. In Windows, you can use BLAT.exe, PSMAIL.exe. In UNIX, you can do by calling command “Mailx” or “mail”.
In Windows Environment:
PSMAIL.exe is a PeopleSoft delivered program.
PSMAIL.EXE looks for the environment variable PS_SERVER_CFG to retrieve its SMTP Settings. That variable is usually set on the Application Server and Process Scheduler on boot up. On the Application Server, it usually is set to %PS_HOME%\appserv\\psappsrv.cfg. On Process Scheduler, it usually points to %PS_HOME%\appserv\prcs\\psprcs.cfg.
Following are the possible command line arguments:
TO = the recipients of the email
CC = carbon copy list of recipients
BCC = blind carbon copy list of recipients
FROM = the sender of the email
SUBJECT = the subject heading of the email
BODY = the email body
FILE = list of file attachments to send with email. File location is relative to where PSMAIL.EXE is run from.
ALIAS = Used to create a short name for the file being attached, otherwise the receiver gets the complete path/filename
INPUT =points to a config file that contains the above seven arguments. This was to bypass the maximum number of characters allowable on a command line and carriage return/line feeds.
The tokens – or / can be used in front of the above arguments. The values for each argument must be encapsulated in double quotes. Look at the following examples.
Sample usage:
PSMAIL -TO”rob_smith@abct.com” -FROM”SystemTest_InvRpts@abc.com”
-SUBJECT”Daily Inventory Report(s)”
PSMAIL /TO”edward_jones@abc.com” /FROM”HR@abc.com” /SUBJECT”Time Out
Reporting” /BODY”Please report any PTO for the month of March.”
PSMAIL /INPUT”demo1.txt”
The content of the file, “demo1.txt” is as below:
-TO”lisa_harper@abc.com;Robert_thomas@abc.com”
-FROM”SystemTest_InvRpts@abc.com”
-SUBJECT”System Test Daily Inventory Report(s)”
-BODY”Here is the report(s) you requested. (Both A & B Databases)”
-FILE”d:\temp\ps\e800r20\in_bu_bal_A.out;d:\temp\ps\e800r20\in_bu_bal_B.out”
If you are using -INPUT or /INPUT then you need to have the input file in UNICODE format. (On NT, you can do this by saving the file in notepad as “Unicode format” & on Unix you can run the following PeopleSoft binary file: PSUNICONV ASCII UCS-2 )
BEGIN-PROCEDURE sendmail
let $subject = ‘Subject of the Email Here’
let $to_list = ’email@email.com’
let $ReportID = ‘File name along with path’
let $alias =’Attachment File Name Alias including the file extension’
let $enter = chr(10)chr(13)
let $body_txt = ‘Hi,’$enter$enter’Please Find the Report attached with this email.’$enter$enter’Regards,’$enter ‘Peoplesoft Application Support’$enter$enter’PS: We request you not to reply to this automated mail trigger.’
let $mail-cmd = ‘ \\HHOT3Q7CPSH02\psoft\HR880DEV\bin\client\winx86\psmail -TO”‘$to_list'” -SUBJECT”‘$subject'” -BODY”‘$body_txt'” -FILE”‘ $ReportID ‘” -ALIAS”‘$alias'”‘
CALL SYSTEM USING $mail-cmd #Status
if #status <> 0
show ‘ERROR: Could not send email!’
end-if
end-procedure sendmail
In UNIX Environment:
Below is the sample code to send mail from UNIX Environment.
Mail without Body text with attachment:
let $mail-cmd = ‘(uuencode Filename_with_fullpath.extension Filename_to_be_displayed_in_mail.extension)’ | mail –s “Mail Subject” –c “cc Mail Address” to-Mail Address’
call system using $mail-cmd #Status
if #status <> 0
show ‘ERROR: Could not send email!’
end-if
Mail with Body text without attachment:
let $mail-cmd = ‘mail –s “Mail Subject” –c “cc Mail Address” to-Mail Address’
call system using $mail-cmd #Status
if #status <> 0
show ‘ERROR: Could not send email!’
Mail with Body along with Attachment:
Here no need to generate temporary file for mail body.
let $mail-cmd = ‘(echo “hi all “; uuencode ObjectChecker.sqr Object.sqr)’ | ‘mail -s “hi” nadarajvenkadesh.krishnan@aig.com’
call system using $mail-cmd #Status
if #status <> 0
show ‘ERROR: Could not send email!’
end-if
Note: if subject has spaces, then it should be enclosed with double quotes.

No comments:

Post a Comment