IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

To send E-mail using REXX

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
View previous topic :: View next topic  
Author Message
krk_kumar1



Joined: 14 Mar 2006
Posts: 36

Posted: Fri Jun 30, 2006 5:36 pm    Post subject: To send E-mail using REXX  

Hi ,
i recently read in the group that it is possible to send e-mails using rexx. can any one tell me in detail how is this possible and i also read that we can use ICEGENER and SMTP to send it. wht way is ICEGENER is related to this ?

Thanks in advance.
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Fri Jun 30, 2006 5:46 pm    Post subject: Re: To send E-mail using REXX  

Are you using an SMTP server, or do you need to use REXX Sockets?

ICEGENER is the DFSORT functional equivalent of IEBGENER. It performs a copy from one DD to another.
Back to top  
krk_kumar1



Joined: 14 Mar 2006
Posts: 36

Posted: Fri Jun 30, 2006 6:04 pm    Post subject: Re: To send E-mail using REXX  

what is the difference between using an SMTP server and REXX Sockets?
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Fri Jun 30, 2006 8:04 pm    Post subject: Re: To send E-mail using REXX  

The SMTP server accepts formatted data from the JES spool, queues it up and sends it out as a formatted SMTP data stream to your mail server. It handles all of the socket mangement for you, and I believe also provides diagnostic and tracing facilities as well.

Without the SMTP server, you can either use email messaging software, or you have to write your own.
Back to top  
krk_kumar1



Joined: 14 Mar 2006
Posts: 36

Posted: Fri Jun 30, 2006 8:21 pm    Post subject:  

thank you superk. we've REXX/SOCKETS z/OS V1R7 March 1, 2004 . so how do send e-mail from rexx ?
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Sat Jul 01, 2006 2:23 am    Post subject: Re: To send E-mail using REXX  

You can use this sample as a guideline. I highly recommend that you write your own from scratch so that you understand how it works.

Code:
/* REXX EMAIL */
smtp_server      = 'smtp1.ops.mydomain.com'
smtp_from        =  Userid() || '@mydomain.com'
smtp_address     = 'superk@mydomain.com'
smtp_to          = 'superk@mydomain.com'
smtp_replyto     = 'superk@mydomain.com'
crlf = x2c('0d25')

/* SMTP Initialization */
str = Socket('initialize', Date(B))
Parse Var str sockrc subtaskid maxdesc tcpipuser
str = Socket('Socket', 'af_inet', 'stream', 'tcp')
Parse Var str sockrc sockid
str = Socket('SetSockOpt', sockid, 'sol_socket', 'SO_ASCII', 'on')
server_info = 'AF_INET 25 ' || smtp_server
str = Socket('Connect', sockid, server_info)
str = Socket('Recv', sockid, 10000)
Parse Var str sockrc data_length smtp_response
msg= 'HELO ' || smtp_server || crlf
str = Socket('Send', sockid, msg)
str = Socket('Recv', sockid, 10000)

/* Mail Message */
msg= 'MAIL FROM:<' || smtp_from || '>' || crlf
str = Socket('Send', sockid, msg)
str = Socket('Recv', sockid, 10000)
msg= 'RCPT TO:<' || smtp_address || '>' || crlf
str = Socket('Send', sockid, msg)
str = Socket('Recv', sockid, 10000)
msg= 'DATA' || crlf
str = Socket('Send', sockid, msg)
str = Socket('Recv', sockid, 10000)
the_subject = 'This is a Test #1'
msg = 'To:' smtp_to || crlf ,
   || 'Reply-To:' smtp_replyto || crlf ,
   || 'Subject:' the_subject || crlf ,
   || 'X-Mailer: REXX Exec on ZOS' || crlf
str = Socket('Send', sockid, msg)
str = Socket('Send', sockid, crlf)
msg = 'This is a test (#1) from ' || Userid() || crlf
str = Socket('Send', sockid, msg)
msg = crlf || '.' || crlf
str = Socket('Send', sockid, msg)
str = Socket('Recv', sockid, 10000)
/* End of Mail Message */

/* SMTP Termination */
msg= 'QUIT' || crlf
str = Socket('Send', sockid, msg)
str = socket('Close', sockid)
str = socket('Terminate', subtaskid)
Say 'Email sent to ' smtp_to

Exit
Back to top  
dbonney



Joined: 31 Oct 2006
Posts: 1

Posted: Tue Oct 31, 2006 10:35 am    Post subject: Re: To send E-mail using REXX  

SuperK...thanks heaps for that start up code.. I played with here for a project and it worked almost first go..saved me so much time..
:D :D :D
Back to top  
cigarman



Joined: 19 May 2007
Posts: 22
Location: Chicago

Posted: Fri Jul 06, 2007 6:35 am    Post subject: Re: To send E-mail using REXX  

This is a great sample. I cut and pasted, minor editing and when I ran it under Netview I get this.

REXXM6
0
0 98 220 si1.svr.bankone.net ESMTP Sendmail
Switch-3.1.8/Switch-3.1.7; Thu, 5 Jul 2007 21:02:40 -0400**
0 28
0 94 250 si1.svr.bankone.net Hello nss1051.nss.bankone.net
?155.180.146.209!, pleased to meet you**
MAIL FROM:<ralph.a.porter@jpmchase.com>**
0 41
1 0 54 250 2.1.0 <ralph.a.porter@jpmchase.com>... Sender ok**
RCPT TO:<rportermail@comcast.net>**
2 0 35
3 0 56 550 5.7.1 <rportermail@comcast.net>... Relaying denied**
DATA**
4 0 6
DATA**
5 0 33 503 5.0.0 Need RCPT (recipient)**
To: rportermail@comcast.net**Reply-To:
rportermail@comcast.net**Subject: This is a Test #1**X-Mailer: REXX
Exec on ZOS**
6 0 120
7 0 2
71 This is a test (#1) from NETVIEW**
8 0 34
**.**
9 0 5
**.**
10 0 256 500 5.5.1 Command unrecognized: "To:
rportermail@comcast.net"**500 5.5.1 Command unrecognized:
"Reply-To: rportermail@comcast.net"**500 5.5.1 Command
unrecognized: "Subject: This is a Test #1"**500 5.5.1 Command
unrecognized: "X-Mailer: REXX Exec on ZOS"**
11 0 6
12 0
13 2003 ESUBTASKINVALID Subtask ID invalid
Email sent to rportermail@comcast.net

All the output are SAY instructions to see whats going on. Looks like the smtp server doesnt like the format at SAY line 10 above.

Any ideas? I would love to RTFM if I could find a manual to read. Any suggestions?
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Fri Jul 06, 2007 6:40 am    Post subject: Re: To send E-mail using REXX  

Chapter 6. Sending electronic mail using SMTP commands from the z/OS V1R7.0 Comm Svr: IP User's Guide and Commands manual.
Back to top  
ABaluchamy



Joined: 29 Dec 2006
Posts: 16
Location: INDIA

Posted: Wed Nov 05, 2008 4:32 pm    Post subject: Reply to: To send E-mail using REXX  

how can I populate more than one recipients in to address..
Back to top  
acevedo



Joined: 11 May 2005
Posts: 315
Location: Spain

Posted: Wed Nov 05, 2008 4:41 pm    Post subject:  

you can include RCPT TO:<recipient> for every recipient you need.
Back to top  
ABaluchamy



Joined: 29 Dec 2006
Posts: 16
Location: INDIA

Posted: Wed Nov 05, 2008 6:39 pm    Post subject:  

Thanks.
Back to top  
enrico-sorichetti



Joined: 14 Mar 2007
Posts: 3168
Location: italy

Posted: Wed Nov 05, 2008 6:43 pm    Post subject: Reply to: To send E-mail using REXX  

next time please start a new topic rather than piggybacking on a year old thread
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM