View previous topic :: View next topic
|
Author |
Message |
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
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
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
what is the difference between using an SMTP server and REXX Sockets? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
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
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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
New User
Joined: 31 Oct 2006 Posts: 1
|
|
|
|
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..
|
|
Back to top |
|
|
cigarman
New User
Joined: 19 May 2007 Posts: 25 Location: Chicago
|
|
|
|
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
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
how can I populate more than one recipients in to address.. |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
you can include RCPT TO:<recipient> for every recipient you need. |
|
Back to top |
|
|
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
next time please start a new topic rather than piggybacking on a year old thread |
|
Back to top |
|
|
|