Search This Blog

Thursday, January 21, 2010

How to send email from iSeries

I. Simple messageYou will need to know the internet address(es) of the recipient(s).
Use the SNDDST command to send the message.
Example:SNDDST TYPE(*LMSG) TOINTNET((someone@SomeDomain.com) (someoneelse@hotmail.com *PRI)) DSTD(Here is your file!!) LONGMSG(Your test worked great!. Please call me if you have questions/comments. )

II. Send a file as an attachmentThe file must exist in the QDLS directory structure. You need to know the name of the file.You will need to know the internet address(es) of the recipient(s). Use the SNDDST command to send the message.
:SNDDST TYPE(*DOC) TOINTNET((someone@SomeDomain.com *PRI) (someoneelse@hotmail.com *PRI)) DSTD(Here is your file!!) MSG(File TESTMAIL.txt attached) SNDFMT(*NOCHG) DOC(TESTMAIL.TXT) FLR(PCUPLOAD)
This is used when sending mail as well as receiving it. Type the following

CHGSMTPA AUTOSTART(*YES) MAILROUTER('your.isp.smtp.server') FIREWALL(*YES) ALWRLY(*BOTH)* AUTOSTART(*YES) tells the system you want this server to start automatically when TCP/IP is started.

CHGPOPA MSGSPLIT(*NOMAX)

ADDSMTPLE TYPE(*ACCEPT) INTNETADR('192.168.5.0') SUBNETMASK('255.255.255.0')

ADDDIRE USRID(INTERNET GATEWAY) +USRD(‘Internet SMTP gateway’)
SYSNAME(INTERNET) +PREFADR(NETUSRID *IBM ATCONTXT)CHGDSTA SMTPRTE(INTERNET GATEWAY)

STRTCPSVR SERVER(*SMTP)(If it was already running, use ENDTCPSVR to end it. Then use WRKACTJOB SBS(QSYSWRK) to make sure that all of the QTSMTPxxxx jobs end, then use STRTCPSVR to start it up again.)Each user who needs to send e-mail using SNDDST will need to have a directory entry and SMTP e-mail address configured on the iSeries

.ADDDIRE USRID(KLEMSCOT S10262BA) USRD('Scott Klement')

WRKNAMSMTP TBLTYPE(*SYSTEM)1. Use option 1=Add2. Type the same name/address that you used on the ADDDIRE command3. Enter the SMTP e-mail address for this user.Once all of that is done, it should be easy to send off a test e-mail with SNDDST.
SNDDST TYPE(*LMSG) +TOINTNET(('unclebob@example.com')) +DSTD('Put E-mail Subject Here') +LONGMSG('Hi Bob. This is an E-mail message sent from my iSeries system.')

No comments:

Post a Comment