From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sending email

Hi all,

I know NI sells an Internet Developers Toolkit but I don't want to spend
the $500. Not yet at least. I want to send myself an email when a test
has failed or finished.

I can do it manually with a telnet session (see below) but how can I use
LV to automate this task? I'm thinking there must be an easy way bring
new text into the telnet console once it's started with the System
Exec.vi. Any ideas?

The only commands I have to send to the SMTP server are these:

HELO localhost
MAIL FROM: kevin@localhost.net
RCPT TO: kevin@remotehost.net
DATA

Each command must be followed by a carriage return.


For an example, here's a simple telnet session with my local SMTP server:

--- starts here ----

kevin@toffler:~$ telnet localhost 25
Trying 127.0.0.1...

Connected to localhost.
Escape character is '^]'.
220 toffler.valentine.net ESMTP Sendmail 8.11.4/8.11.4; Sun, 15 Sep 2002
10:11:38 -0400

HELO localhost

250 toffler.valentine.net Hello kevin@localhost [127.0.0.1], pleased to
meet you

MAIL FROM: kevin@localhost.net

250 2.1.0 kevin@localhost.net... Sender ok

RCPT TO: kevin

250 2.1.5 kevin... Recipient ok

DATA

354 Enter mail, end with "." on a line by itself

just an email test ...
..

250 2.0.0 g8FED8612793 Message accepted for delivery

New mail for kevin@toffler has arrived: ---- From: kevin@localhost.net
just an email test ...

----
QUIT

221 2.0.0 toffler.valentine.net closing connection Connection closed by
foreign host.
You have mail in /var/spool/mail/kevin kevin@toffler:~

--- stops here ---


Any help is greatly appreciated,
kevin
0 Kudos
Message 1 of 8
(3,862 Views)
Nevermind. I figured it out. I went to the NI site and found a library
in the Search Example Code page. The libary is called "RT email.llb".
Here was the description: "This example sends emails out from a networked
LabVIEW RT controller. Use this VI to send email to a single email
address."

I am running Linux, so the 'Get Network Info.vi' in the libary was broken
because it uses a CIN. I didn't notice a .lsb or any .c files anywhere so
maybe it's broken on windows too. Any comments?

I looked at the 'RT email.vi' and it gave me some ideas. It needed some
modification but I got it to work, at least on my local SMTP server.

Should I document this VI on NI website or something? Mine doesn't
require a CIN, just straight G so it's easy to implement. I think I'll
beat up on it for a while to verify robustness.

Time to go eat.

- kevin

In article , "kevin"
wrote:

> Hi all,
>
> I know NI sells an Internet Developers Toolkit but I don't want to spend
> the $500. Not yet at least. I want to send myself an email when a
> test has failed or finished.
>
> I can do it manually with a telnet session (see below) but how can I use
> LV to automate this task? I'm thinking there must be an easy way bring
> new text into the telnet console once it's started with the System
> Exec.vi. Any ideas?
>
> The only commands I have to send to the SMTP server are these:
>
> HELO localhost
> MAIL FROM: kevin@localhost.net
> RCPT TO: kevin@remotehost.net
> DATA
>
> Each command must be followed by a carriage return.
>
>
> For an example, here's a simple telnet session with my local SMTP
> server:
>
> --- starts here ----
>
> kevin@toffler:~$ telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 toffler.valentine.net ESMTP Sendmail 8.11.4/8.11.4; Sun, 15 Sep 2002
> 10:11:38 -0400
>
> HELO localhost
>
> 250 toffler.valentine.net Hello kevin@localhost [127.0.0.1], pleased to
> meet you
>
> MAIL FROM: kevin@localhost.net
>
> 250 2.1.0 kevin@localhost.net... Sender ok
>
> RCPT TO: kevin
>
> 250 2.1.5 kevin... Recipient ok
>
> DATA
>
> 354 Enter mail, end with "." on a line by itself
>
> just an email test ...
> .
>
> 250 2.0.0 g8FED8612793 Message accepted for delivery
>
> New mail for kevin@toffler has arrived: ---- From: kevin@localhost.net
> just an email test ...
>
> ----
> QUIT
>
> 221 2.0.0 toffler.valentine.net closing connection Connection closed by
> foreign host.
> You have mail in /var/spool/mail/kevin kevin@toffler:~
>
> --- stops here ---
>
>
> Any help is greatly appreciated,
> kevin
0 Kudos
Message 2 of 8
(3,862 Views)
Kevin,

If you are interested in making these open source, send me an email. I can fill you in on the details.

-Jim Kring
0 Kudos
Message 3 of 8
(3,844 Views)
Thanks Jim!

I still want to clean it up some more but I'll contact you very soon.

- kevin valentine
0 Kudos
Message 4 of 8
(3,844 Views)
NI has a section of this website where you can upload your code.

In my opinion, it is better to post your code here on NI's website, as it is a centralized place where people can look for code.

Thanks for offering to put this up. There are people out there in need of such functions that don't have the internet toolkit.


Also...

You can use the TCP/IP functions to communicate with the SMTP server. The only thing about this is that you have to know the base commands, which it sounds like you have a good grasp of.
Message 5 of 8
(3,844 Views)
Dear Kevin,
Please could you send me the VI you have developed for sending emails using SMTP. I cannot afford the LV Internet Connectivity Toolkit & need to only send emails to myself in case my remote application detects an alarm.
Your help will be greatly appreciated,
Thanks in advance,
Shapoor
mail : shapotools@vsnl.com
0 Kudos
Message 6 of 8
(3,844 Views)
Shapoor,

I've made a few slight upgrades to the one you can download from the NI
site:

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/
c71733565269b24c86256c38000f1c49/$FILE/SendEmail.zip

I'll email you my most recent one. (not sure how to upload revisions to
the NI site, don't see an option for that)

I can't guarantee that it will work for you. Some people (including
myself) have found it won't work with servers that require authentication.
I simply don't have that feature built in yet. Perhaps someoneelse would
like to work on that (hint-hint).

It also doesn't send binary attachments yet. I've trying to build my own
ftp client in LV but that's been slow progress. I may just focus my
efforts on email attachments.

BTW,
I found this email client developed by Chris Degen
(degen@bnlux1.bnl.gov) on the Info-Labview site:
http://www.info-labview.org/the-archives/vi/lv4/smtp_mailer_3_0_0.zip

I think I'm going to use some of his techniques to beef-up my
SendEmail.vi. His includes SMPT server response verification which is
good idea.

Thanks for the interest!

-Kevin
kevinvalentine
at
netzero.net
0 Kudos
Message 7 of 8
(3,845 Views)
Dear Kevin,
Thanks for the VI,s. They were sufficient for my application needs.

I use LV Datasocket for FTPing files to my server. Its easy to use & LV includes several examples.

Thanks again,
Regards
Shapoor
0 Kudos
Message 8 of 8
(3,843 Views)