class Object
Constants
- CONFIG_FNAME
- OPTIONS
Send mail via Command line This will save your defaults as environment variables so that you do not have to constantly add them I mainly use this for testing email on different browsers
Public Instance Methods
export()
click to toggle source
# File bin/send, line 38 def export puts "What is your gmail email? " OPTIONS.from = gets.chomp puts "What is your gmail password? " OPTIONS.password = STDIN.noecho(&:gets).chomp puts "Who should we send the email to by default? " OPTIONS.to = gets.chomp write_config end
read_config()
click to toggle source
# File bin/send, line 17 def read_config if File.file? CONFIG_FNAME f = open(CONFIG_FNAME) contents = Base64.decode64(f.read) OPTIONS.from = contents.match(/^from=(.*)$/)[1] OPTIONS.to = contents.match(/^to=(.*)$/)[1] OPTIONS.password = contents.match(/^password=(.*)$/)[1] f.close end end
write_config()
click to toggle source
# File bin/send, line 28 def write_config contents = '' contents << "from=#{OPTIONS.from}\n" contents << "to=#{OPTIONS.to}\n" contents << "password=#{OPTIONS.password}" f = open(CONFIG_FNAME, 'w') f.write(Base64.encode64(contents)) f.close end