Email from Parallax PINK internet module
Tracy Allen
Posts: 6,664
Hi Ryan, or others,
I've scanned the documentation, and it is not clear to me how to get content from the Stamp into the "file".
How can this file get there, and/or, what is the *.txt file?
What I want to do is send text data from the Stamp to email, or post the entire content on a web page. Is that possible? The text file on the Stamp may be thousands of bytes long.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I've scanned the documentation, and it is not clear to me how to get content from the Stamp into the "file".
From the PINK docs: • Nb_varEC is the email CONTENT: register. When using the PINK to send email, this register will hold the name of the file containing the content for the email message. The file must be on the PINK module prior to sending an email message. A *.txt file will be written out as the body text of an email message if indicated in the Nb_varEC variable.
How can this file get there, and/or, what is the *.txt file?
What I want to do is send text data from the Stamp to email, or post the entire content on a web page. Is that possible? The text file on the Stamp may be thousands of bytes long.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Comments
As I understand it, the file must be present on the PINK.
You put it on the PINK via the pc software.
The file references variables using <Nb_varXX> that are filled in
before sending. You may specify a *.htm file also.
The maximum of changeable data in a file is thus limited
to 100*63 = 6300 bytes.
I don't think you can write a file to the PINK
from the stamp.
regards peter
Post Edited (Peter Verkaik) : 11/5/2005 7:06:45 PM GMT
from the documentation.....
serout 8,396,[noparse][[/noparse]"!NB0W06:25",cls]·· will write the value 25 to RAM variable 6 on the PINK, I can't deduce if you can then use this in an email , my PINK is on the way so I can't test anything yet. I think a better way to accomplish this is to use the UDP functionality, break up your long string in 64 byte chunks, write them to the PINK then send them off to a server/pc for concatenation and publishing. Once I get my pink I intend on writing some tools with softwire, I will then share them with the community if I am successful. I hope UPS doesnt ban me fom their website for checking my tracking info every 5 minutes...hehe j/k
·
So, the text file I have will be put in variables. The following might be a snippet to move 20 lines of data (each <64 bytes long and CRLF delimited) from the Stamp into 20 sequential variables on the netburner...
The file on the netburner will consist of the following types of statements:
<Nb_var20>
<Nb_var21>
<Nb_var22>
<Nb_var23>
<Nb_var24>
<Nb_var25>
...and so on...
<Nb_var39>
Is that close? The file structure is predetermined at ftp time from a PC, and is given a name that is called via the Nb_varEC file pointer variable. Is is there a way to make the number of lines in the file depend on a variable? What is sent if a variable is empty?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I think that's it. The file would be a htm file (webpage format).
I assume an empty Nb_varXX prints nothing.
You would clear a variable by sending CLS directly afer the ':'
You are wise to use var_20 and higher only. As I understand
the first 20 vars·are loaded from flash upon powerup or reset,
but I do not·yet know how to reset the PINK from the stamp,
so best not to overwrite them, until that is clear.
regards peter
Post Edited (Peter Verkaik) : 11/5/2005 8:58:40 PM GMT
I think it is allowed to put CR and LF into the variables. So you could fill up
variables to 63 bytes (the last byte must be CLS).
regards peter
Secondly, you can get the variables by referencing them in a webpage (if that is what you are trying to do)-
The stamp may update the variables. (Or the variables may be updated via the web interface as well)-
This setup is very open ended. In the even that I just wanted some text sent, I just put that in the 'file name'- in this case the email will send something to the effect of "File: (TEXT HERE)" cannot be found." - This was a quick and dirty way of just sending a simple text message, rather than the contents of a file (it helped with testing, debugging, etc)-
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Also, okay about embedding the CRLF within the variables. By running it together, and by using all 100 variables, the body text could be up to 6400 bytes. You implied that the CLS (ascii 0 for the Stamp) is also put in the variable, at the end of the message, so there can only be 63 characters + CLS. Are you sure about that? Does that actually serve as an "end of variable" marker? Maybe it reads out to CLS or 64 bytes, whichever comes first. I wonder if it treats any of the other control characters in a special way?
Ryan, I'm not sure what you mean when you say, "the payload file can be of any type", and also, "these mail messages may be dynamic, if they are HTML." I want the Stamp to determine the body text of the email message. It is not just a canned message. Do variables only work inside of HTML tags? For example, if I create the following file and save it as busybody.txt, and then fill up the variables from the Stamp, will the body of the message then be the content of those variables?
Sorry for the untried questions. I guess I'll just have to wait until I have one of these in hand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
·· If anyone deserves to be able to ask a bunch of questions, it's you.· As I recall you are usually the one answering them!· Ryan will be happy to answer any of these questions.· I'm sure others would benefit from it as well.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
If anyone deserves to be able to ask a bunch of questions, it's you. As I recall you are usually the one answering them! Ryan will be happy to answer any of these questions. I'm sure others would benefit from it as well.
Hi Tracy,
Hope this will help:
Say I wanted to know the value of the registers in the PINK via email. I would create a file that had in the body a reference to each of the variables I'd like to see. For example, if I wanted to know the value of the file that was going to be sent via email, I'd put this in the body:
<Nb_varEC>
Keep in mind this could be in a *.txt file, HTML, etc...it doesn't matter. What happens is the PINK will take the 'content file' and parse it, and anywhere it sees a reference to the variable names, called out by the <> brackets, it will fill in what ever the current value of the register is.
e.g. I just created a file called "email" (no file extension at all). In the body of that file was the folllowing:
The value in the varEC register is: <Nb_varEC>
(That was the only line in the file.) Then I sent an email to myself, and in the body text of that email was the following:
The value in the varEC register is: email
The way the emails are 'dynamic' is in that parsing that takes place. The thinking is that you can create different 'forms' such as an email for showing certain kinds of data, that only pulls on certain registers. Of course one could put ALL the registers into a mail, but then the message would be bigger.
I hope this makes sense. If it doesn't please ask for clarification.
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Say you create a file with no extension, say "testfile" - then in the body of that you have <> references to variables. When sent via email , the actual values will be reflected in place of the <> references. However, if you browse to the file (for example: http://XX.XX.XX.XX/testfile where XX.XX.XX.XX is the ip of your module)- then the page WILL NOT reflect the value, but just the text as it was originally written in the file. To have the webpage parsed and reflect the value of the variables, the file must be an HTML file. Simply changing the file extension in the example above will cause the value of the register to be displayed.
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
RClarke@Parallax.com
Can we fill up variables to 64 bytes or only 63 and must the last byte be the CLS
character (which is a binary 0)? What happens if we write 65 bytes to a variable?
For udp messages:
Since a binary 0 is used as end of variable marker, can we still use escape sequences
to put in binary values? Say I use '\','\' for the \ character and '\','0' for the binary 0
and a receiving stamp would be aware of that, will that work? If·binary
byte values 1-255·have no special meaning I believe that should work.
regards peter
Post Edited (Peter Verkaik) : 11/7/2005 11:40:06 AM GMT
Ryan, the files I want to transmit are tab delimited weather data or stuff like that, and the transmission will occur once per day, so the file will consist of some multiple of 24 lines of data.
So if I understand this right, email or UDP is less exacting than web page display. For email or UDP, I can put any extension I want on the file, and the parser will fill in the values of the variables and I don't need any HTML tags right? However, for web page display, the variable tags have to be bracketed with valid HTML <body> etc. tags?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
i.e. I must set it up with the SMTP address and the Port and username and password. Talk about overkill!!!
- Ryan Miller
·
·· There is no solution other than to perhaps set up your own mail server or find an alternate. ·The PINK module firmware is not set up to do what you ask.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
- Ryan Miller
·
·· While I know there is mail server software available I am not familiar with any of it.· I am actually using the UDP Message feature instead.· In theory you could setup a PC Application (which you would have to write) that could take a UDP Message and send it via your normal e-mail client software.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
- Ryan Miller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support