Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To send E-mail using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Fri Jun 30, 2006 5:36 pm    Post subject: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jun 30, 2006 5:46 pm    Post subject: Re: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Fri Jun 30, 2006 6:04 pm    Post subject: Re: To send E-mail using REXX
Reply with quote

what is the difference between using an SMTP server and REXX Sockets?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jun 30, 2006 8:04 pm    Post subject: Re: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Fri Jun 30, 2006 8:21 pm    Post subject:
Reply with quote

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

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Jul 01, 2006 2:23 am    Post subject: Re: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message
dbonney

New User


Joined: 31 Oct 2006
Posts: 1

PostPosted: Tue Oct 31, 2006 10:35 am    Post subject: Re: To send E-mail using REXX
Reply with quote

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..
icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
cigarman

New User


Joined: 19 May 2007
Posts: 25
Location: Chicago

PostPosted: Fri Jul 06, 2007 6:35 am    Post subject: Re: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jul 06, 2007 6:40 am    Post subject: Re: To send E-mail using REXX
Reply with quote

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
View user's profile Send private message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

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

how can I populate more than one recipients in to address..
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Nov 05, 2008 4:41 pm    Post subject:
Reply with quote

you can include RCPT TO:<recipient> for every recipient you need.
Back to top
View user's profile Send private message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Wed Nov 05, 2008 6:39 pm    Post subject:
Reply with quote

Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

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

next time please start a new topic rather than piggybacking on a year old thread
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
No new posts Mail via SMTP with an image? Mike 1304 JCL & VSAM 4 Thu Jan 26, 2017 2:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us