Hi guys, nice being a part of this community, sorry for my english if some sentences doesnt make much sense. Well, my question is i have a file, i liked to make a script that for example, in 1 or 2 hours would get the txt file where its located in the same folder of the script and send it to my email.
Could you guys give me some pointers?
Be well
bonucci
0
Newbie Poster
Recommended Answers
Jump to PostI know this is a C++ forum, but why don't you just do this in Ruby?
Otherwise, make a thread that sleeps for 60 seconds and increments a counter by 1, when the counter is 120 (2 hours), reset it to 0 and execute the file read.
Save …
Jump to Postrequire 'net/smtp' $message = '' file = File.new("file_path_name_etc.txt", "r") while (line = file.gets) message << "#{line}" end file.close Net::SMTP.start('smtp.domain.com', 25) do |smtp| smtp.open_message_stream('from_addr', [to_addr]) do |f| f.puts 'From: youremail@address.com' f.puts 'To: recipient@domain.com' f.puts 'Subject: your subject' f.puts message end end ## Pretty much sums it up, minus …
All 5 Replies
Unimportant
18
Junior Poster
bonucci
0
Newbie Poster
Unimportant
18
Junior Poster
bonucci
0
Newbie Poster
Unimportant
18
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.