daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 7th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   # Sends mail to several recipients.
  2.   #
  3.   # param recipients - an array of addresses ex ["kim@armada.nu", "tobias@armada.nu", " otto@armada.nu"]
  4.   def send_mail recipients, subject, message
  5.     require 'net/smtp'
  6.    
  7.     Net::SMTP.start('localhost', 25) do |smtp|
  8.       smtp.open_message_stream('noreply@niwen.armada.nu', to) do |f|
  9.        
  10.         f.puts "From: noreply@niwen.armada.nu"
  11.         f.puts "To: " + recipients[0]
  12.         f.puts "Bcc: " + recipients[1 .. recipients.length].join(', ')
  13.         f.puts "Subject: #{subject}"
  14.         f.puts "MIME-Version: 1.0"
  15.         f.puts "Content-type: text/html"
  16.         f.puts message
  17.       end
  18.     end
  19.  
  20.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top