Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Automaticall download email?

Options
  • 29-05-2006 1:46pm
    #1
    Closed Accounts Posts: 584 ✭✭✭


    Hey all,

    Does anyone know if its possible to create an application that automatically downloads an .xls file attachment from an email?

    I have 2 sites. I want site one to send an .xls to site 2, via an application. Theres no broadband, only dial-up. Site 1 logs in, fills in the data (numbers), hits send. The application sends the email with the .xls as an attachment to site 2's email account. Site 2 dials up, logs in, hits download and the app displays the contents and stores the .xls on disk.

    Can javamail do this? smtp? Can anyone think of an alternative solution? Maybe sending by email isnt the best way...

    Thanks a million,

    Jeff


Comments

  • Registered Users Posts: 1,193 ✭✭✭liamo


    hallelujah wrote:
    Does anyone know if its possible to create an application that automatically downloads an .xls file attachment from an email?
    Any email client can download an attachment regardless of its extension.
    I have 2 sites. I want site one to send an .xls to site 2, via an application. Theres no broadband, only dial-up. Site 1 logs in, fills in the data (numbers), hits send. The application sends the email with the .xls as an attachment to site 2's email account. Site 2 dials up, logs in, hits download and the app displays the contents and stores the .xls on disk.
    What is the problem that you're trying to solve. Why are you trying to solve it this way?
    Can javamail do this? smtp? Can anyone think of an alternative solution? Maybe sending by email isnt the best way...
    You might use the JavaMail API within a Java application to take care of the mailing part. SMTP is a protocol.

    From your description of the process, there appears to be a user involved on both sites. Given that the process is not an unattended operation, and that you're proposing using email to communicate this information, I can't see any reason to try to automate it other than trying to make it easier for the users.

    However, if the user(s) can't send or receive an email or use a Spreadsheet application to open an attachment, then perhaps training is the solution, not automation.

    Regards,

    Liam


  • Closed Accounts Posts: 584 ✭✭✭hallelujah


    liamo wrote:
    Any email client can download an attachment regardless of its extension.


    What is the problem that you're trying to solve. Why are you trying to solve it this way?


    You might use the JavaMail API within a Java application to take care of the mailing part. SMTP is a protocol.

    From your description of the process, there appears to be a user involved on both sites. Given that the process is not an unattended operation, and that you're proposing using email to communicate this information, I can't see any reason to try to automate it other than trying to make it easier for the users.

    However, if the user(s) can't send or receive an email or use a Spreadsheet application to open an attachment, then perhaps training is the solution, not automation.

    Regards,

    Liam

    Thanks for your response. I will elaborate on my points..

    Every morning eggs are delivered from site1 to the site2 in a van. The driver hands a worker at site2 a hand filled-out sheet with an egg count. Site 2 worker then takes the sheet and puts in the data into an xls file. The xls file uses its formulas to create statistics on the eggs. So the xls spreadsheet has many tabs/sheets for every month.


    Manager doesnt not want to have to manually enter this. He wants the data sent over the web from site1 to site2 - no more sheet or manual entering. As they only have dial-up, I need away to get the data from site1 where site 2 can then access it.

    Needs:

    Site1 - Need an application that lets user1 enter the egg data and send to site 2.

    Site2 - User2 uses his application to access the egg data sent from site1, View it and store it. The xls spreadsheet that they already use could be replaced by a database. Its just a placeholder for the data.

    "there appears to be a user involved on both sites" - there is.
    "that you're proposing using email to communicate this information" - it was just one idea, may be completely wrong..

    I only mention email as one way of sending the data, considering they only have dialup. I am basically looking for a way to transfer the data. Would be great if you or anyone else could point me in the right direction.

    Regards,
    Jeff


  • Registered Users Posts: 683 ✭✭✭Gosh


    Does anyone know if its possible to create an application that automatically downloads an .xls file attachment from an email?

    This is exactly what your email client (Outlook, Thunderbird, etc, etc) does - it retrieves the email and any attachments (in this case a .xls spreadsheet) and saves them in your inbox. So yes, it automatically downloads to your inbox. The next step is for you to read the email and open the attachment.

    So site1 user sends and email to site2 user - site2 user checks his inbox, opens the email, clicks on the attachment which in most cases would fire up Excel and open the spreadsheet.

    Don't really understand why it's more difficult than this ...


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    Web Services would be a far better solution for this kind of thing. I assume site 2 needs to automatically receive this file without human intervention needed. So a web service on site 2. Site 1 uploads a file via a web page which sends the file to the web service. Web service then saves file to wherever.


  • Closed Accounts Posts: 584 ✭✭✭hallelujah


    Gosh wrote:
    This is exactly what your email client (Outlook, Thunderbird, etc, etc) does - it retrieves the email and any attachments (in this case a .xls spreadsheet) and saves them in your inbox. So yes, it automatically downloads to your inbox. The next step is for you to read the email and open the attachment.

    So site1 user sends and email to site2 user - site2 user checks his inbox, opens the email, clicks on the attachment which in most cases would fire up Excel and open the spreadsheet.

    Don't really understand why it's more difficult than this ...

    I dont want the user doing this.... I want an application to do this. I dont want the either user to be fuking around with an xls sheet. If Outlook, etc, is so good, how am i going to create an application that takes the data as input, opens outlook, creates and email + attachment and sends. Then have the site2 application do the opposite. Dont think thats possible.

    The web service seems to be a good idea. At least that way an application/web page can be created.


  • Advertisement
  • Closed Accounts Posts: 584 ✭✭✭hallelujah


    musician wrote:
    Web Services would be a far better solution for this kind of thing. I assume site 2 needs to automatically receive this file without human intervention needed. So a web service on site 2. Site 1 uploads a file via a web page which sends the file to the web service. Web service then saves file to wherever.

    maybe my thread title was incorrect. theres no automation needed. Site 1 sends the data. Then, at no specific time, site 2 access the sent data.


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    hallelujah wrote:
    maybe my thread title was incorrect. theres no automation needed. Site 1 sends the data. Then, at no specific time, site 2 access the sent data.

    You may not even need a web service then. Just a web site on site 2 that site 1 can upload the file to. Site 2 saves the file on the server and your app can grab it whenever it wants.


  • Closed Accounts Posts: 584 ✭✭✭hallelujah


    musician wrote:
    You may not even need a web service then. Just a web site on site 2 that site 1 can upload the file to. Site 2 saves the file on the server and your app can grab it whenever it wants.

    so site1 PC would be the 'server' where the data would reside on a file. Site2 PC would download the file, then display and store it?
    So I'd need to buy a web domain?

    BTW whats the difference between a web service and web site?

    excuse the ignorance.


  • Registered Users Posts: 1,193 ✭✭✭liamo


    Emailing a file from place to place with each user adding data and passing-it-on means you have multiple copies of a file in different states in different locations. It could lead to a lot of confusion and possibly a loss of data.

    Unless there is a requirement for the spreadsheet to be "live", perhaps a mixture of a web page and a spreadsheet would provide a better solution.

    It would be a straighforward matter to build a web-page that users could use to enter their data. At this point there would be no calculations carried out. At the end of the day, week or month the manager could download the entered data in a form that could be imported into your spreadsheet.

    Alternatively, it may be possible/practical for the calculations to be built into the web application so that the spreadsheet is removed from the equation entirely.


    Regards,

    Liam


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    hallelujah wrote:
    so site1 PC would be the 'server' where the data would reside on a file. Site2 PC would download the file, then display and store it?
    So I'd need to buy a web domain?

    BTW whats the difference between a web service and web site?

    excuse the ignorance.

    Well setting up a website at either site 1 or 2 may be too expensive. A cheap hosting with someone might be good enough with a web page where someone at site 2 could upload the excel file and then your app on site 2 could request the file from the website at a later time.

    Web Service - link
    Web Site - your looking at one :)


  • Advertisement
  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    liamo wrote:
    I can't see any reason to try to automate it other than trying to make it easier for the users.

    God forbid anyone would want to make things easier for users ;)

    Anyway....ttackling the original question:

    GIven that you're using two disconnected clients, email is probably your best bet. Without requiring both clients to be logged in at the same time, you need some sort of store-and-forward system, and mail is arguably the handiest. Sure, you could set up a web-site and do all sorts of cool stuff, but if you've got two sites, a low budget, and all the rest of it....mail does exactly what you want.

    The way I see it you have three basic processes.

    1) Data Entry at site 1
    2) Transmission of Data from site 1 to site 2
    3) Processing of received data at site 2, to "main storage".

    I'd get the data-entry program to send a formatted email i.e. an email with the data in the body (as XML, fixed-width, comma-delimited, or whatever). If you really want to use an attachment like a .xls, go ahead, but I wouldn't have thought it gains much (indeed, manipulating a .xls will not only be version-dependant, it may also limit the range of languages suitable).

    In an ideal world, I'd have a dedicated mailbox for this to be sent to (i.e. one that was only used for receiving this formatted data), but you can live without one.

    I'd then write a program for site 2 which would check an inbox for mails, and either process them directly into wherever your main storage is if they are correctly formatted. Decide what you want to do with non-correctly-formatted mails. If its not a dedicated a/c, probably nothing.

    Whether you want this to be "run on demand" or "always on, checking mailbox every 60 seconds" or something is pretty-much a non-issue.

    As to what to write it in...if you need to open/manipulate an Excel spreadsheet, you'll need something which understands either OLE, COM (ActiveX), or .Net. If all you need to do is force the saving of the file to a particular location, then anything which understands SMTP is probably enough.


  • Closed Accounts Posts: 584 ✭✭✭hallelujah


    bonkey wrote:
    God forbid anyone would want to make things easier for users ;)

    Anyway....ttackling the original question:

    GIven that you're using two disconnected clients, email is probably your best bet. Without requiring both clients to be logged in at the same time, you need some sort of store-and-forward system, and mail is arguably the handiest. Sure, you could set up a web-site and do all sorts of cool stuff, but if you've got two sites, a low budget, and all the rest of it....mail does exactly what you want.

    The way I see it you have three basic processes.

    1) Data Entry at site 1
    2) Transmission of Data from site 1 to site 2
    3) Processing of received data at site 2, to "main storage".

    I'd get the data-entry program to send a formatted email i.e. an email with the data in the body (as XML, fixed-width, comma-delimited, or whatever). If you really want to use an attachment like a .xls, go ahead, but I wouldn't have thought it gains much (indeed, manipulating a .xls will not only be version-dependant, it may also limit the range of languages suitable).

    In an ideal world, I'd have a dedicated mailbox for this to be sent to (i.e. one that was only used for receiving this formatted data), but you can live without one.

    I'd then write a program for site 2 which would check an inbox for mails, and either process them directly into wherever your main storage is if they are correctly formatted. Decide what you want to do with non-correctly-formatted mails. If its not a dedicated a/c, probably nothing.

    Whether you want this to be "run on demand" or "always on, checking mailbox every 60 seconds" or something is pretty-much a non-issue.

    As to what to write it in...if you need to open/manipulate an Excel spreadsheet, you'll need something which understands either OLE, COM (ActiveX), or .Net. If all you need to do is force the saving of the file to a particular location, then anything which understands SMTP is probably enough.

    If I was to use the email idea is the following the right method?

    Site1 - write an application that has email capabilities, e.g. javamail. This app has an interface with input boxes. The user dials up, fills in the data, hits send. Behind the scenes, the app creates an email message with the data in the body of the email (no attachment??), and sends the email to a dedicated email account, eg. site2@yahoo.ie.

    Site2 - write an application using javamail (or other) that allows the data to be accessed. The user dials up, hits 'view data and store'... Behind the scenes the app checks the inbox, sees the mail, reads it, parses its data and displays the data to the user and stores.

    I dont want the user going near www.yahoo.ie (or any commercial site) to download the email. I want my nice user firendly app to do this.. Is it still possible for my app to check the inbox without going to the yahoo website (or whatever email i use)??


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    bonkey wrote:
    Sure, you could set up a web-site and do all sorts of cool stuff,

    A one page website with 2 lines of code. Pretty cool. There would be expense to creating a web site. I mean I am paying at least $1.99 a month for my current asp.net site hosting so it's deffinately got to be considered carefully.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    musician wrote:
    A one page website with 2 lines of code. Pretty cool. There would be expense to creating a web site. I mean I am paying at least $1.99 a month for my current asp.net site hosting so it's deffinately got to be considered carefully.

    Uh-huh. And security-wise? How to you prevent some joker from finding your site and uploading crap in place of the files you want to store there? Or worse - downloading the data that you've stored elsewhere.

    Setting up websites properly and knowing they are secure, stable and all the rest of it is not trivial. Setting them up wrongly is simple, and you will generally never know the difference until you get bitten in the ass.

    With email, where you're using a third-party email provider (as appears to be the case here) the only question you really have to ask yourself is whether or not you will encrypt your data. All of the rest of the configuration etc. is taken care of for you.

    Note: I'm not saying that it can't be done with a web-server, but from the sounds of things, the fewer areas to worry about the better.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    hallelujah wrote:
    Site1 - write an application that has email capabilities, e.g. javamail. This app has an interface with input boxes. The user dials up, fills in the data, hits send. Behind the scenes, the app creates an email message with the data in the body of the email (no attachment??), and sends the email to a dedicated email account, eg. site2@yahoo.ie.
    Pretty much. Depending on what you write the app in, it may be able to do a simple "test if line is up, and offer to bring it up if necessary" step as well, which means the user doesn't even have to worry about being dialled up.
    Site2 - write an application using javamail (or other) that allows the data to be accessed. The user dials up, hits 'view data and store'... Behind the scenes the app checks the inbox, sees the mail, reads it, parses its data and displays the data to the user and stores.
    Spot on.
    I dont want the user going near www.yahoo.ie (or any commercial site) to download the email.
    Correct. The app can/should/will do this.
    Is it still possible for my app to check the inbox without going to the yahoo website (or whatever email i use)??
    AS long as the mail you use isn't a "web-client only" thing, then absolutely.

    BTW - an issue you may not have considered:

    No matter how you implement this, there is always the possibility that the data gets lost after it is sent but before it is received. In an ideal world, you'd implement some sort of "receipt" system:

    Site1 prepares and sends data, and saves a local copy
    Site2 receives and stores sent data, and sends a receipt.
    Site 1 checks for receipt. When it finds & verifies it, it can remove the local copy. If Site 1 doesn't find the receipt within X time, it offers to resend / automatically resends the data.

    Note that this will also require Site2 to be able to determine when its been sent duplicates.

    Asynchronous transmission is a b1tch like that...

    jc


Advertisement