dirtbikedude
asked on
coding to automatically email a line of text
Ok I'm struggling a little bit on how to approach this. We are trying to get an email to go out every morning at a certain time with a random phrase that we specify. Here's the catch, the phrases come from an ebook, we use the kindle software and when you make notes on particular phrases you can export them to things like text files, etc. What we are looking to do is write a script or batch file or something that will look into this file pick a random line (phrase) that we had exported from our ebook and email it to the specified email address. Do you have any suggestions on what I should do to achieve this? what you would do? any programs or scripts to use or if I have to write a script should it be a batch or what? or would web based be the way to go?
Suggestions or advice would be highly appreciated.
Thanks!
Suggestions or advice would be highly appreciated.
Thanks!
If you are already using a database, storing the lines of text in the database and scheduling it from the database would make controlling the aspects of the email much more dynamic and versatile
ASKER
If I wanted to do it as a batch file. Can you guys give me the code that I would make a batch out of so that it takes a line of text from a text file and emails it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
You have already exported it to a TextFile.
Than I would suggest a Small app that you can schedule or a windowsService that has a Timer to run Once a day.
What must be done. :
Read the File to know the number of lines.
c : http://www.mrx.net/c/readfunctions.html
c#: http://blogger.xs4all.nl/zomerf/archive/2008/10/02/416167.aspx
Use this as a max for your random generating number
Read that line of the file
Create the MailMessage and add the line to the body
Send the mail
c : http://bytes.com/topic/c/answers/843485-how-send-email-c
c#: http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8
Why a batch : Easy to use, easy to run, easy to schedule, easy to deploy :
Why a WindowsService : scheduling is automated, easy to deploy , invisible running.
regards
poor_beggar