Created
February 27, 2019 17:35
-
-
Save nachoal/e25553ecfb584d59065b51a27b27c743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mail' | |
require 'csv' | |
password = 'AQUI TU CONTRASEÑA' | |
user = "AQUI TU CORREO (gmail)" | |
csv_options = { col_sep: ',', quote_char: '"', headers: :first_row } | |
filepath = 'correos.csv' | |
options = { | |
address: 'smtp.gmail.com', | |
port: 587, | |
user_name: user, | |
password: password, | |
authentication: 'plain', | |
enable_starttls_auto: true | |
} | |
Mail.defaults do | |
delivery_method :smtp, options | |
end | |
CSV.foreach(filepath, csv_options) do |row| | |
Mail.deliver do | |
to row['Correos'] | |
from user | |
subject 'Gracias por probar nuestro servicio!' | |
body "Muchas gracias por suscribirte a nuestro servicio #{row['nombre']}, estamos buscando a tu bringer" | |
end | |
puts "Correo enviado a #{row['Correos']}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment