Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use this step to confirm you have completed the previous steps correctly. You will need access to another IBM i IBM i or a PC to which you will send the test mail message.

1.  Send a mail message using OfficeVision or the SNDDST command to your test recipient (as described in Step 2).

2.  Send a mail message from a LANSA function using the Email Built-In Functions. You may use the following sample function or create one of your own. To keep the example simple we have omitted error handling, but you would normally check the return codes in your real-life application:FUNCTION OPTIONS

     FUNCTION OPTIONS(*DIRECT);
**********

...

 COMMENT();
**********

...

 COMMENT(Working fields, lists and groups);
**********

...

 COMMENT();

...

     DEFINE FIELD(#ORGL)

...

 TYPE(*CHAR)

...

 LENGTH(60)

...

 LABEL('From')

...

 DESC(

...

 'Mail message originator');

...

     DEFINE FIELD(#RCPL)

...

 TYPE(*CHAR)

...

 LENGTH(60)

...

 LABEL('To')

...

 DESC('

...

Mail message recipient');

...

     DEFINE FIELD(#SUBJECT)

...

 TYPE(*CHAR)

...

 LENGTH(60)

...

 LABEL('Subject')

...

 DESC('

...

Mail message subject');

...

     DEFINE FIELD(#RET_CODE)

...

 TYPE(*CHAR)

...

 LENGTH(2)

...

 DESC('

...

BIF returncode');
GROUP_

...

BY NAME(#PANELDATA)

...

 FIELDS(#ORGL #RCPL #SUBJECT);
**********

...

 COMMENT();
BEGIN_LOOP;

...

     REQUEST FIELDS(#PANELDATA)
**********

...

 COMMENT(Start a mail message);

...

     USE BUILTIN(MAIL_START)

...

 TO_GET(#RET_CODE)
**********

...

 COMMENT(Add the originator);

...

     USE BUILTIN(MAIL_ADD_ORIGINATOR)

...

 WITH_ARGS(#ORGL)

...

 TO_

...

GET (#RET_CODE);
**********

...

 COMMENT(Add the recipient);

...

     USE BUILTIN(MAIL_ADD_RECIPIENT)

...

 WITH_

...

ARGS (TO #RCPL) TO_GET(#RET_CODE);

...

 
**********

...

 COMMENT(Set the mail message subject);

...

     USE BUILTIN(MAIL_SET_SUBJECT)

...

 WITH_ARGS(#SUBJECT)

...

 TO_

...

GET (#RET_CODE);
**********

...

 COMMENT(Send the mail message);

...

     USE BUILTIN(MAIL_SEND)

...

 TO_GET(#RET_CODE);
END_LOOP;
RETURN;

...