|
I'm successfully using the JavaMail program. I've created wrappers for
it, mind you not ILE code, but good RPGIV.
It uses a codes table if a code is sent to it, otherwise it accepts the
from email address and to email address. Here's the code, I'll dig up the
properties file and send it in another email. What error code are you
getting? It doesn't matter about the AS/400 DIRE's. They aren't used by
the Javamail program.
? ?*****************************************************************
??*? Program: SENDEMAIL
? ?*? Date : FEB 07, 2003
???*****************************************************************
??? h dftname(sendemail) Datedit(*YMD) Option(*SrcStmt : *NoDebugIO)
?femailcdpf if e k disk
fqsysprt o f 132 printer oflind(*inof)
d from S 50
d fromadr S 50
d to S 50
d replyTo S 50
d subject S 50
d errcde S 3
d filename S 100
d text S 9999
d rtnCode S 3
d rtnText S 50
d firstpas S 1
d sysnam S 8
d dashes S 132
d tabn s 2 0 dim(12) ctdata perrcd(1)
EXPANDED DATE TAB
d taba s 9 dim(12) alt(tabn)
d date ds
d odate 18
d omnth 9 overlay(odate)
d ofil1 1 overlay(odate:10)
d oday 2 0 overlay(odate:11)
d ocoma 2 inz(', ')
d overlay(odate:13)
d oyear 4 0 overlay(odate:15)
d odd s 2 0
d omm s 2 0
d oyy s 4 0
??* Program requires a mailing code and a from address, from address
only used
??* if different than from address in mailing codes file.
c *entry plist
c parm emailcd
c parm fromadr
c parm filename
c parm subject
c parm errcde
?* Set first pass flag
c eval firstpas = '1'
c call 'GETSYS'
c parm sysnam
?* Start the environment variables
c call 'STRMAIL'
?* Using passed email code get the parms for sending the email.
c emailcd chain emailcdpf 99
c 99 exsr nocode
c *in99 doweq '0'
c if fromadr <> ' ' and fromadr <> emfrom
c eval from = fromadr
c else
c eval from = emfrom
c endif
?* Default replyto to always be the from address.
c eval replyTo = from
c eval text = emtext
c eval to = emaddr
?* Call javamail program to send email
c call 'JAVAMAIL'
c parm from
c parm to
c parm replyTo
c parm subject
c parm text
c parm filename
c parm rtnCode
c parm rtnText
?* Check for error message on return
c eval errcde = rtnCode
c rtnCode ifne '000'
c firstpas ifeq '1'
c except head
c eval firstpas = '0'
c endif
c *inof ifeq '1'
c except head
c eval *inof = '0'
c endif
c except deterr
c endif
c emailcd reade emailcdpf
99
c enddo
?* Stop the environment variables
c call 'CLSMAIL'
c Eval *InLr = *On
?*-----------------------------------------------------------------
?* This routine will generate an expanded date from the
?* fields oyy, omm, and odd which are the year, month and day
?* fields of the desired date.
?* The expanded date will be placed in the field 'ODATE'
?* by this subroutine.
c oxdate begsr
c omm lookup tabn taba
10
c movel taba omnth
c eval oday = odd
c eval oyear = oyy
c endsr
*-----------------------------------------------------------------
?* Initialization subroutine, run first time pgm called
c *inzsr begsr
Y2K c eval oyy = *year
c eval omm = umonth
c eval odd = uday
c exsr oxdate
c move *all'-' dashes
c endsr
?*-----------------------------------------------------------------
?* Code not found on file for email code sent, give error message
c nocode begsr
c firstpas ifeq '1'
c except head
c eval firstpas = '0'
c endif
c *inof ifeq '1'
c except head
c eval *inof = '0'
c endif
c except detcde
c Eval Errcde = 'NCD'
c endsr
?*-----------------------------------------------------------------
oqsysprt ef head 03 03
o page z 130
o odate 118
o 80 'Email exception
report lis+
o t '
o 18 '/SENDEMAIL'
o sysnam 8
o ef head 01
o 14 'Email Address/'
o 67 'Exception Message'
o ef head 01
o 13 'Filename '
o ef head 01
o dashes 132
o ef deterr 01
o to 50
o rtnText 100
o ef deterr 01
o filename 100
o ef detcde 01
o 14 'Email code: '
o emailcd 18
o 36 ' not found please '
o 53 'check codes file!'
**
01 JANUARY
02 FEBRUARY
03 MARCH
04 APRIL
05 MAY
06 JUNE
07 JULY
08 AUGUST
09SEPTEMBER
10 OCTOBER
11 NOVEMBER
12 DECEMBER
Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Tel: 709-576-8132
Email: rpower@xxxxxxxxxx
Website: http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. -
Sir Winston Churchill
MWalter@xxxxxxxxxxxxxxx
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
25/05/2005 04:02 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc
Subject
Using Javamail w/RPG
I'm having a problem using the Javamail program w/RPG.
I used Mr. Zhang's example, and wrapped the calls into a service program.
The return code is saying that the Send Mail Completed Normally, but the
mail is not delivered. I'm wonder about the Javamail.properties file. What
should that file look like? Also, SMTP attributes. I'm trying to send
email
from my iSeries user id, 'mark at hanoverwire.com' to my personal email
address. I have 'mark at hanoverwire.com' listed in WRKNAMSMTP. It works
with SNDDST. Not sure what's happening here.
Is anyone successfully using this?
Thanks,
Mark
Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.