Guest User

Sending an image

a guest
Jun 20th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.64 KB | None | 0 0
  1. How to send this image to email/text message??? This is my basic code, Ive tried many different ways to do it, but no luck.
  2.  
  3.  uri = URI("http://open.mapquestapi.com/staticmap/v4/getplacemap?key=Fmjtd%7Cluub2gu8l9%2C25%3Do5-9uaggw&location=1200+Juliana+St,Parkersburg,WV&size=400,400&type=map&zoom=16&imagetype=jpg&showicon=red_1-1")
  4.   image = Net::HTTP.get(uri)
  5.  
  6.   # t = File.open("map.jpg", 'wb')
  7.   # t.write(file)
  8.   # t.close
  9.   smtp = Net::SMTP.new 'smtp.gmail.com', 587
  10.   smtp.enable_starttls()
  11.   smtp.start('gmail.com', '[email protected]', 'password', :login)
  12.   smtp.send_message(image, '[email protected]', contacts)
  13.   smtp.finish()
Advertisement
Add Comment
Please, Sign In to add comment