I am trying to send mail from the mainframes. I have searched the forum to my level best but my problem is not solved yet. I had asked a query about this topic earlier but this is different.
I tried to send the mail using IEBGENER. Please find my code as below.
Code:
//S02MAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
HELO RMBJES
MAIL FROM:<XXXX.YYYY@ABC.CO.UK>
RCPT TO:<XXXX.YYYY@ABC.CO.UK>
DATA
FROM: XXXX.YYYY@ABC.CO.UK
TO: XXXX.YYYY@ABC.CO.UK
SUBJECT: TEST MESSAGE FROM MVS USING SMTP
THIS IS A LINE IN THE BODY OF THE NOTE.
I submitted the job. Return code was zero. But i didn't get the mail. So i tried with IKJEFT01 utility.
In the above JCL, i tried to use SYS3A.PPG.CLIST in the SYSEXEC DD instead of SYS1.SISPEXEC first. But it was not available. Then using TSO ISRDDN command i found out the SYSEXEC dataset. But when i submitted the above job i got the following error message.
Code:
READY
%SMTPSEND PREFIX
IKJ56500I COMMAND SMTPSEND NOT FOUND
READY
END
Then i tried to get the SMTP status using TSO SMSG SMTP STATS which threw the message as follows:
Code:
EZY2045I SMSG: SMTP not logged on
I still didn't leave it. I tried again the following command.
tso xmit rmbjes.smtp da('my.ps.file')
I got the below message.
Code:
INMX000I 0 message and 2 data records sent as 829 records to RMBJES.SMTP
INMX001I Transmission occurred on 05/07/2010 at 13:59:54.
But I don't know where to see the transmitted file. So does this succesful transmit mean SMTP is working?
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
Code:
//S02MAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
HELO RMBJES
MAIL FROM:<XXXX.YYYY@ABC.CO.UK>
RCPT TO:<XXXX.YYYY@ABC.CO.UK>
DATA
FROM: XXXX.YYYY@ABC.CO.UK
TO: XXXX.YYYY@ABC.CO.UK
SUBJECT: TEST MESSAGE FROM MVS USING SMTP
THIS IS A LINE IN THE BODY OF THE NOTE.
This is not a valid email. It will not, under any circumstances, ever be delivered.
If you check RFC 2821 and RFC 2822, which are the official requirements for SMTP emails, or even search this forum where I have talked about this in other topics, you will find that you are absolutely required to have a line with a period in the first column and nothing else on that line as the last line of your email. Leave off this period, and the email is not valid and will not be sent.
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
This works for me. I believe you can have issues with your note if you don't have a blank line after the SUBJECT: line.
Code:
HELO SMTP.COM
MAIL FROM: <MAIL.ROOM@MYCOMPANY.COM>
RCPT TO: JIM.SHORTS@MYCOMPANY.COM
DATA
TO: JIM.SHORTS@MYCOMPANY.COM
FROM: DO.NOT.REPLY@MYCOMPANY.COM
DATE:
SUBJECT: THIS IS A TEST SUBJECT LINE
Don't forget to mail the bosses package.
We frequently and successfully send individual notes without a period in position one, however, if you are sending many notes under the same JCL step, each note must be separated by a line with a period in position one. Failure to do this will cause some of your emails not to be delivered. I found this out when I sent out about 200 emails and only about 50 were actually received.
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
From RFC 2821:
Quote:
Klensin Standards Track [Page 17]
RFC 2821 Simple Mail Transfer Protocol April 2001
DATA <CRLF>
If accepted, the SMTP server returns a 354 Intermediate reply and
considers all succeeding lines up to but not including the end of
mail data indicator to be the message text. When the end of text is
successfully received and stored the SMTP-receiver sends a 250 OK
reply.
Since the mail data is sent on the transmission channel, the end of
mail data must be indicated so that the command and reply dialog can
be resumed. SMTP indicates the end of the mail data by sending a
line containing only a "." (period or full stop). A transparency
procedure is used to prevent this from interfering with the user's
text (see section 4.5.2).
The end of mail data indicator also confirms the mail transaction and
tells the SMTP server to now process the stored recipients and mail
data.
If you are sending emails without a period at the end, either your site is adding it automatically without your knowledge, or you are not using SMTP to do so. Based on what you said about multiple emails not being sent, I suspect your site adds it without you knowing it.