Random Ramblings on LabVIEW Design

Community Browser
Labels
cancel
Showing results for 
Search instead for 
Did you mean: 

Fun With Emails

swatts
Active Participant

Howdy Doody LabVIEW Lovelies

Emails are great for circumventing firewalls and IT. It has been very useful for our bug reporting system to have an on-board email client and a dedicating email address. We just give it out to customers and away we go!

So here's how we did it.

First we need a POP email client and one can be downloaded here.

We wrote a bit of code to plug the email details into our bug reporting database (this gives us a metric of how quickly we respond to an issue for ISO9000).

EMail1.png

We can then query the database and search for any new emails in the system, this is done on a button press with my pretty email button.

EmailButton.png

All nice and easy....except when you add attachment and also every single email server appears to format it's emails differently (currently I'm fixing it on command but I really need to do some more studying of this).

First issue was attachments. Some descriptions of this are included here

Email is sent as text and therefore the attachment will need encoding into data that is safe to transport. The most common method appears to be base 64. For us base 64 is pretty marvelous for encoding blobs in databases (Binary Large OBjects) for similar reasons to emails we don't want spurious control characters as part of your SQL query. In fact I would now recommend encoding any entered free text as base64 into a query.

Here is how it looks in my database.

base64.png

So the only time I want to decode it is when I display the attachment.

Base64Decode.png

Someone cleverer than I wrote this (search base 64 decode).

An attachment is essentially made of 3 parts, the filename, the mimetype and the encoded attachment data, you then recreate the file in a temp directory and display it in a universal mimetype display (the webbrowser does this very well)

The other challenge is parsing the email and I haven't got a very robust solution to this at the moment, every new email I get from a different server appears to have a different standard. I need to hit the books I think or do a reiterating parse until I get something useful (yuck!)

There! an article with LabVIEW in it, hope it is useful

Lots of love Steve

PS there is a bug in the Pop VIs that can't handle large attachments, I'll be happy to help (supply code) if there is an interest.

PPS encode and decode base64 is useful for other stuff too where you need to restrict the types of characters.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Comments