Page 1 of 1

SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:17:27 GMT

Information required please.

Interested in responses to the following questions.

Anyone built a JADE solution to allow connection to SMTP servers from JADE. If so what classes/connections did you use?

Anyone got a requirement to do the above in the near (6-8 month) future?

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:17:56 GMT

Don
Anyone built a JADE solution to allow connection to SMTP servers from JADE. If so what classes/connections did you use?


I've sort of done it. I've seen sendmail do the same thing, If all you wish to do is send mail.

e.g. here is a sample command line from the help file

1) sendmail -messagefile=msg.txt -subject="This is the subject" name@host.com
This will send a plain text file file msg.txt to user name@host.com

All you have to do is call this command line. Simple enough. Download sendmail from winfiles.com.
Anyone got a requirement to do the above in the near (6-8 month) future?

Alan Thomson is doing this right now for Kiwi Dairy Coop


Leigh

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:18:43 GMT

Hi
I have achieved my objective of being able to issue emails from a JADE application to an SMTP mail server.

I setup the External Function shellExecute (as described in Geoff Davies submission). This is very useful as it allows you to call many Windows programs (with parameters) from within JADE e.g. Word, Excel, Notepad --- as well as the New Message dialogue of your email client. With the latter it can pre-fill the recipients email address -- but that's as far as it goes. You can't fill the text of the email or have it sent automatically.

I scanned the Internet for SMTP tools and came across "SendMail for Windows" from the WinFiles.com NT Mail clients site --- you can get it too from http://www.winfiles.com/apps/nt/mail-clients.html

This allows you to install SendMail as a Windows application. You have to configure it to register your mail servers host name -- but that's about it.

Then within your JADE application you have to create a temporary ASCII text file with some header information detailing who you are sending the email to, who it's from and the subject --- and then the actual text you wanna send.

The disadvantages of this approach is that :
this is making use of the third party utility and this one anyway has to be registered and paid for for commercial use
it's a "command line utility" (and a "convert job" from UNIX) so unfortunately it displays a yukky DOS box for a few seconds
There are other utilities around and I would welcome feedback on other peoples experience with them?

Ideally the shellExecute function should be part of JADE and extensible(!) to allow the email text to be passed and an instruction to automatically send the email. Perhaps this will be included with JADE 5 ?

Here is a JADEScript I wrote for testing it :

vars
tempfile: File;begin

create tempfile;
tempfile.fileName := "C:\temp\TEMPMAIL.TXT";
tempfile.kind := File.Kind_ANSI;
tempfile.mode := File.Mode_Output;

tempfile.writeString("Subject: Its life Jim -- but not as we know it" & CrLf);
tempfile.writeString("From: Alan Thomson<athomson@clear.net.nz>" & CrLf);
tempfile.writeString("To: Alan Thomson<athomson@cardinal.co.nz>" & CrLf & CrLf);
tempfile.writeString("With reference to Complaint: 00345 raised 17 Jun 1998" & CrLf);
tempfile.writeString("You have been assigned responsibility" & CrLf); tempfile.writeString("Please accept or otherwise within JACS ASAP" & CrLf);
tempfile.writeString("." & CrLf);

call
shellExecute(1,"open","sendmail"," -messagefile=c:\temp\TEMPMAIL.TXT -t", null, 1);
end;

Ciao .................
Alan J.Thomson
ph...Auckland 09-277-7961 x 744
http://home.clear.net.nz/pages/athomson

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:19:13 GMT

We are using a similar tool, Blat!, to send email from perl scripts on various Windows boxes within Cardinal.

See http://gepasi.dbs.aber.ac.uk/softw/Blat.html

I don't know how it compares to sendmail for NT, but given sendmail for Unix's reputation for being large and buggy, I'd say Blat could be worth a look. We've had no trouble with it.

Its also free and comes with source code.

Graeme

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:19:46 GMT

Hi Newsgroupers,
I have experimented with the BLAT utility for sending an email via an SMTP server and it works well and in a similar manner to the SendMail utility described in an earlier posting.

The JADEScript to test it out (see previous posting) only had to be modified a little in that you create a text file with the content of your email and you have to issue a 'close' of the text file after writing the last line to it (otherwise Blat reports an error processing it -- SendMail didn't seem to need it !!).

It still throws up a yukky ancient DOS box -- but only momentarily -- and it's free unlike SendMail. So, I will pursue use of it in my current application.

BLAT is supposedly available from a whole host of sites listed in the main Blat website detailed Graeme Joyce's earlier posting -- but alas these are all rubbish. Instead get it from here -- it's less than 100K.

The README.TXT and README.HENQUIN files detail the installation, use of and enhancements made to Blat. The installation section talks about copying over CW3215.DLL from the Blat directory to your WINNT\SYSTEM32 directory. However, I couldnae find no trace of this dll in the Blat software -- but the functionality I require seemed to work fine without it.

Ciao .................
Alan J.Thomson
ph...Auckland 09-277-7961 x 744
http://home.clear.net.nz/pages/athomson


From: Graeme Joyce
We are using a similar tool, Blat!, to send email from perl scripts on various Windows boxes within Cardinal.

See http://gepasi.dbs.aber.ac.uk/softw/Blat.html

I don't know how it compares to sendmail for NT, but given sendmail for Unix's reputation for being large and buggy, I'd say Blat could be worth a look. We've had no trouble with it.

Its also free and comes with source code.

Graeme

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 1:22:37 GMT

Hi Newsgroupers,
I have experimented with the BLAT utility for sending an email via an SMTP server and it works well and in a similar manner to the SendMail utility described in an earlier posting.

The JADEScript to test it out (see previous posting) only had to be modified a little in that you create a text file with the content of your email and you have to issue a 'close' of the text file after writing the last line to it (otherwise Blat reports an error processing it -- SendMail didn't seem to need it !!).

It still throws up a yukky ancient DOS box -- but only momentarily -- and it's free unlike SendMail. So, I will pursue use of it in my current application.

BLAT is supposedly available from a whole host of sites listed in the main Blat website detailed Graeme Joyce's earlier posting -- but alas these are all rubbish. Instead get it from here -- it's less than 100K.

The README.TXT and README.HENQUIN files detail the installation, use of and enhancements made to Blat. The installation section talks about copying over CW3215.DLL from the Blat directory to your WINNT\SYSTEM32 directory. However, I couldnae find no trace of this dll in the Blat software -- but the functionality I require seemed to work fine without it.

Ciao .................
Alan J.Thomson
ph...Auckland 09-277-7961 x 744
http://home.clear.net.nz/pages/athomson


From: Graeme Joyce
We are using a similar tool, Blat!, to send email from perl scripts on various Windows boxes within Cardinal.

See http://gepasi.dbs.aber.ac.uk/softw/Blat.html

I don't know how it compares to sendmail for NT, but given sendmail for Unix's reputation for being large and buggy, I'd say Blat could be worth a look. We've had no trouble with it.

Its also free and comes with source code.

Graeme

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by Geoff Davies >> Mon, 13 Mar 2000 1:14:32 GMT

The neatest solution is to use JADE's own TcpIpConnection class.
No extra software needed!!
Test the following code in a JadeScript.
You will have to replace the smtp string variable with
the domain name or ip address of your mail server.

Good Luck Geoff
**********************************************************************************

vars
tcp : TcpIpConnection;
smtp : String;
from : String;
too : String;
sub : String;
msg : String;begin

smtp := "143.96.31.69"; // replace with your own mail server
from := "<gdavies@jade.co.nz>"; // replace with your email address
too := "<person@somewhere.com>";
sub := "Hello World";
msg := "The traditional greeting.";

create tcp;
tcp.port := 25; // port for outgoing mail
tcp.name := smtp; // domain name or ip address of mail server
tcp.open;
tcp.writeBinary(("HELO " & app.computerName & CrLf).Binary);
tcp.writeBinary(("MAIL From: " & from & CrLf).Binary);
tcp.writeBinary(("RCPT To: " & too & CrLf).Binary);
tcp.writeBinary(("DATA" & CrLf).Binary);
tcp.writeBinary(("From: " & from & CrLf).Binary);
tcp.writeBinary(("To: " & too & CrLf).Binary);
tcp.writeBinary(("Subject: " & sub & CrLf).Binary);
tcp.writeBinary(CrLf.Binary);
tcp.writeBinary((msg & CrLf ).Binary);
tcp.writeBinary((CrLf & "." & CrLf).Binary);
tcp.writeBinary(("QUIT" & CrLf).Binary);
epilog
tcp.close;
delete tcp;
end;
**********************************************************************************

Re: SMTP connectivity from JADE

Posted: Fri Aug 07, 2009 11:12 am
by ConvertFromOldNGs
by David Mitchell >> Mon, 13 Mar 2000 2:38:28 GMT

Surely the solution would be to use the CardSchema SMTPConnection class?

--
David Mitchell
JADE Kid - 1998
www.jadekids.com