Author Topic: Rexx Socket / SMTP  (Read 15021 times)

David Graser

  • Hero Member
  • *****
  • Posts: 870
  • Karma: +84/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #15 on: May 07, 2019, 12:57:15 am »
Have found various "rexx-sendmail-programs" but none of them can be used since they don't support SSL.

Tried PMMail, which receives mail ok, but unable to send. It has lots of configuration options so most likely
I have not set it up right, (so can't use PMMSEND for now).
(Smtp configuration in Seamonkey is easy and works fine.)

Some more searching lead me to:

https://sourceforge.net/projects/rexxcurl/files/rexxcurl/2.0/rexxcurl20os2_RexxTrans.zip/download

Seems like rexxcurl supports SSL and is the right tool.

PMMail is tricky to set up.  Doug bissett helped me with my setup.   I made four pics to show how mine is setup.

Try using the same local port numbers I use for secure poxy.   See how these same numbers are used under the Send and Receive Tabs.
« Last Edit: May 07, 2019, 12:59:59 am by David Graser »

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #16 on: May 07, 2019, 02:08:51 am »
2David Graser: REXXCURL is an interface to cURL, and cURL is for HTTP (including https). How could it
help with SMTP over SSL?

As far as I can see, newer versions of PMMail use stunnel for SMTP over SSL. So, we could use it too
for the same purpose.

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #17 on: May 07, 2019, 02:13:50 am »
It's not SMTP, but my IMAPADD script demonstrates how to use IMAP via REXX to add a message to the remote mail server.
http://www.altsan.org/programming/rexx/index.html#imapadd

I used to use it to have PMMail copy all incoming messages to my IMAP account.

So, PMMail already can use IMAP, instead of POP3??? Your script should write an email message into
an IMAP folder. But how could it help with sending emails with SMTP?

Per E. Johannessen

  • Sr. Member
  • ****
  • Posts: 251
  • Karma: +3/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #18 on: May 07, 2019, 12:53:10 pm »
Thanks David, I tried various port settings and the following works:

Channel definition Outgoing: Server port 465 and Local port 7587

Account settings SEND: Port 587
If I leave "Allow non-secure" unchecked I get a warning; There is no secure Authentication method available for the SEND server.
When checked there is no warning. In both cases it sends the e-mail.

The option "Use secure channel (SSL) is grayed out, so stlll something is wrong.

xynixme

  • Guest
Re: Rexx Socket / SMTP
« Reply #19 on: May 07, 2019, 02:14:07 pm »
IIRC, attachments have to be base64-encoded, but I don't know how they are appended to the message text.
MIME headers and body in a single message text file: https://stackoverflow.com/questions/23340291/attachments-not-recognized-despite-base64-being-sent-in-header. No Rexx sample code, but you should be able to recognize all required parts while viewing a sample text message with an editor or by using a raw e-mail view mode.

IIRC there's a BASE64 encoder written in Rexx ("ENBASE64.CMD"). Albeit you may want to avoid excessive file-I/O, to avoid running out of shared memory more frequently when the Object Rexx interpreter is in use.

If you need some level of control when external EXEs like MAILTO.EXE and some ENBASE64.EXE are in use, then using a BCC header could be an option to verify that sizes and numbers sent e-mails are matching expectations. If the source code of an e-mailing EXE is available, then a Rexx DLL could be an option too. A BASE64 Rexx DLL function may already exist. If not, then writing that component should be easier than writing an e-mailing Rexx DLL.

xynixme

  • Guest
Re: Rexx Socket / SMTP
« Reply #20 on: May 07, 2019, 03:45:27 pm »
IIRC there's a BASE64 encoder written in Rexx ("ENBASE64.CMD").
A few candidates at Hobbes, to take care of that part: BASE64.ZIP (Rexx CMD file(s)), or Kiewitz' XtraRexx v0.44b (Rexx DLL file).

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 387
  • Karma: +5/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #21 on: May 08, 2019, 01:32:08 am »
It's not SMTP, but my IMAPADD script demonstrates how to use IMAP via REXX to add a message to the remote mail server.
http://www.altsan.org/programming/rexx/index.html#imapadd

I used to use it to have PMMail copy all incoming messages to my IMAP account.

So, PMMail already can use IMAP, instead of POP3???

Well, sort of, but only with this script (and only to copy messages to an IMAP account).

Quote
Your script should write an email message into an IMAP folder.

Maybe I'll try extending it to do that some day.

Quote
But how could it help with sending emails with SMTP?

It doesn't, directly. But part of the original question was asking for code to demonstrate how to initialize/use TCP/IP sockets from REXX.

Per E. Johannessen

  • Sr. Member
  • ****
  • Posts: 251
  • Karma: +3/-0
    • View Profile
Re: Rexx Socket / SMTP
« Reply #22 on: May 14, 2019, 08:03:19 pm »
Just an update;  a kind soul has provided code that works using REXXCURL.