Send email through JCL - Mainframe

Sending Email from Mainframe

Hello All......,

Yes we can send email from mainframe...using the IBM utility called IEBGENER. All you need to do is provide the From Address, recipients adress(To Address)..and the content...The following code explains the how we can do it from JCL.



Sample Code to send an Email from JCL


//SENDMAIL JOB (XXX,YYY), 'MAIL FILE ', MSGCLASS=T, CLASS=S, REGION=M

//STEP010 EXEC PGM=IEBGENER

//SYSPRINT DD SYSOUT=*

//SYSIN DD DUMMY

//SYSOUT DD SYSOUT=*

//SYSUDUMP DD SYSOUT=D

//SYSUT2 DD SYSOUT=(Z,SMTPTEST)

//SYSUT1 DD DSN=TEST.EMAIL.HEADER,DISP=SHR

// DD DSN=TEST.EMAIL.CONTENT,DISP=SHR

//************************************* END OF JOB ********************************

(Click on the image for better view)
(Click on the image for better view)

In the above example we can see that there are two files. The following are the contents of these two files.

File1: TEST.EMAIL.HEADER

Content:

HELO Mailserver

MAIL FROM: <XXXXXXXXXXXXXX@ABC.CO.IN>

RCPT TO: <XXXXXXXXXX@BDC.COM>

RCPT TO: <ZZZZZZZZZZZZZZ@ABC.CO.IN>

DATA

FROM: <XXXXXXXXXXXXXX@ABC.CO.IN>

TO: <XXXXXXXXXX@BDC.COM>

CC: <ZZZZZZZZZZZZZZ@ABC.CO.IN>

SUBJECT: Test Mail Sent from Mainframe

(Click on the image for better view)
(Click on the image for better view)

File2: TEST.EMAIL.CONTENT

Content:

MIME-VERSION: 1.0

CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="BOUNDARY"

-- BOUNDARY

CONTENT-TYPE: TEXT/PLAIN; CHARSET=US-ASCII

CONTENT-TRANSFER-ENCODING: 7BIT

Hi All ,

This is a test mail sent form mainframe .

Regards,

Mainframe Team.

*** Note: The Record format of the above two files should be same.

(Click on the image for better view)
(Click on the image for better view)

Want to know how to send an email with an attachment click on the below link

How to send an email with an attachment from mainframe

More by this Author


Comments

No comments yet.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working