Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

E-mail / SMTP

105 views
Skip to first unread message

Raiko

unread,
May 2, 2019, 10:39:12 AM5/2/19
to
I'd like to automate sending e-mails with attachment from a Rexx program I have created, (classic REXX, OS/2).

Does anyone have code sample to login/authenticate to a smtp-server, fill in subject, to/from, some email-text and attach a file?

Garry Smithwick

unread,
May 3, 2019, 8:27:04 AM5/3/19
to
On Thursday, May 2, 2019 at 10:39:12 AM UTC-4, Raiko wrote:
> I'd like to automate sending e-mails with attachment from a Rexx program I have created, (classic REXX, OS/2).
>
> Does anyone have code sample to login/authenticate to a smtp-server, fill in subject, to/from, some email-text and attach a file?

You can use the SendEmail.exe program. Here is an example of using SendEmail to send via gmail:

Address Command 'SendEmail.exe' '-s smtp.gmail.com:587 -xu' user '-xp' pass '-o tls=yes' attachment '-f' from '-t' SendTo '-u' '"'subject'"' TextAppend


Download SendEmail from here:

http://caspian.dotconf.net/menu/Software/SendEmail/

-a file
-cc
-bcc
-l logfile
-v -- verbosity
-q -- quiet

-o message-content-type=<auto|text|html>
-o message-file=file
-o reply-to=address
-o username=username



There are other email exe's if you search.

Raiko

unread,
May 3, 2019, 9:42:00 AM5/3/19
to
SendEmail seems to be a good tool, but OS/2 is not listed as a supported platform. (OS/2 comes with it's own sendmail.exe but it's not an option in this case.)

Derek J Decker

unread,
May 3, 2019, 10:54:14 AM5/3/19
to
This could be done completely in REXX, I don't have any sample code handy
for this, though.

However, I've used mpack in OS/2 (and now, Linux) for years to send email
messages with attachments from the command line on a regular basis. It
would be simple to call this from an OS/2 Classic Rexx program - you
could be done this afternoon.

From the man file, the syntax is :

mpack [ -a ] [ -s subject ] [ -d descriptionfile ] [ -m maxsize ]
[ -c content-type ] file address ...


Mpack is still available on Hobbes -

<http://hobbes.nmsu.edu/h-viewer.php?dir=/pub/os2/util&file=mpack15o.zip>

I haven't set this up on OS/2 in a long time - I believe you'll have to
have a working SMTP server on your OS/2 machine set to relay email to the
proper external servers. Back in the day, I used weasel for this -

<http://hobbes.nmsu.edu/h-viewer.php?dir=/pub/os2/apps/internet/mail/
server&file=weasel_2.5.zip>

Much easier to setup than the old sendmail.

Hope this was helpful,

-Derek



nospa...@efbe.prima.de

unread,
May 3, 2019, 10:55:26 AM5/3/19
to
Am 03.05.19 um 15:41 schrieb Raiko:
> SendEmail seems to be a good tool, but OS/2 is not listed as a supported platform. (OS/2 comes with it's own sendmail.exe but it's not an option in this case.)
>
For OS/2 you can use pmmsend.exe from PMMail.

Raiko

unread,
May 3, 2019, 11:26:14 AM5/3/19
to
Thanks for suggestions, will have a look at both Mpack and PMMail.

Still, out of personal interest, I'd like to see the Rexx code needed for this task.

Derek J Decker

unread,
May 3, 2019, 11:54:39 AM5/3/19
to
I haven't tested these personally, but OK. This would be how to do it the
hard way.

OK, you're sending an email with an attachment. First, this attachment
will have to be encoded, either UUENCODE or Base64.

<http://hobbes.nmsu.edu/h-viewer.php?dir=/pub/os2/dev/
rexx&file=base64.zip>

is an example REXX program that will do the encode.

The encoded block of text for the attachment will have to be combined
with the text of the email in proper MIME/multipart format. This is just
text manipulation, straightforward with REXX,you'll have to look at the
MIME RFCs to see how that should look. Mpack saves you all this trouble,
can also be used to write an output file as an example of what the email
should look like raw.

Once your email with attachment is MIME formatted properly, you'll want
to send it out via SMTP to a trusted server. Here's an article with
example code that purports to so this:

<http://www.edm2.com/index.php/
Send_Mail_to_an_Email_List_with_REXX,_SMTP_and_Sockets>

A local SMTP server or pmmsend.exe would save you the trouble here.


Those would eb most of the parts you'd need.

Have fun!

-Derek


John Small

unread,
May 4, 2019, 9:15:18 AM5/4/19
to
On Thu, 2 May 2019 14:39:10 UTC, Raiko <p...@raiko.no> wrote:

> I'd like to automate sending e-mails with attachment from a Rexx program I have created, (classic REXX, OS/2).
>
> Does anyone have code sample to login/authenticate to a smtp-server, fill in subject, to/from, some email-text and attach a file?

Another possibility for this would be RexxMail. It has both a WPS and
command line interface (the latter for your needs).

It can be downloaded from:
<http://www.os2site.com/sw/internet/mail/client/rexxmail/rexxmail_2006
1224_155329.zip>

--

John Small

igorpo...@gmail.com

unread,
May 29, 2019, 4:37:38 PM5/29/19
to
Hi,

I wrote a REXX function package many called rexxweb that will allow sending of e-mails including attachments by a REXX script.

There are 60+ functionsin the library which I developed when I use to use REXX for cgi based websites.

Its available on hobbes.nmsu.edu

Search for rxweb151.zip

Cheers,

Igor
0 new messages