One option is to use smtplib — SMTP protocol client. Is it possible to use bpxwdyn from Python? If sou, allocate a SYSOUT dataset and use essentially the same logic as the REXX code. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 עַם יִשְׂרָאֵל חַי נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר
________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of Samuel Alejandro Díaz Chávez <[email protected]> Sent: Wednesday, September 18, 2024 2:43 PM To: [email protected] Subject: SMTP zOS in Python Good afternoon, The question I have is a bit complex, but I do require your support. I give a little context... I have a very large project in which I have to “translate” REXX programs to python, and all executed via BATCH. As a first program, I have to make one that, send some files via email. I already have the whole program that does that, but I just need the SMTP sending part, but I have no idea how to call the z/OS SMTP task or service with Python. I understand that with the following structure, in REXX you can do it: /* REXX */ LPAR = 'TEST LPAR ' SMTP.1 = 'HELO' MVSVAR('SYSNAME') SMTP.2 = 'MAIL FROM:<[email protected]>' SMTP.3 = 'RCPT TO:<[email protected]>' SMTP.4 = 'DATA' SMTP.5 = 'FROM:<[email protected]>' SMTP.6 = 'TO:<[email protected]>' SMTP.7 = 'SUBJECT:'LPAR'-DETAILS' SMTP.8 = 'These are high priority alerts... ' "ALLOC F(SMTPOUT) SYSOUT(B) WRITER(SMTP)" IF RC <> 0 THEN DO SAY 'ERROR ALLOCATING SYSOUT FOR SMTP WRITER' EXIT 12 END "EXECIO * DISKW SMTPOUT (STEM SMTP. FINIS" IF RC <> 0 THEN DO So I ask for your support to know if there is a way to send an email through a python program executed by BATCH and if you have any example, I would also appreciate it very much. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
