Net/SMTP Question

V

Vell

Hello all,

I am trying to get Net/SMTP to send emails to 2 separate arrays of
emails within the same block of code. I use this script to send out
notifications for testing and I want to be able to cc the developers
on the fly if I need to. Right now there is an array of email for the
people that need to test and then a separate array for the developers
that I want to CC if I need to. The reason I am doing it this way is
for mainly for the placement of email address'. I don't want to have
the developers in the To: line of the email but the CC: line. Right
now if I try to use this it will send the email to the first array of
emails but seems to stop there and not move on to the second array
emails. Can anyone help me understand what it is that I am doing
wrong?


Here is the snippet of code I'm working with:

require 'net/smtp'
emailsto = []
emailcc = []


email_to = gets.scan(/\S+/).join(',')
emailto << email_to

emails = gets.scan(/\S+/).join(',')
emailcc << emails

email = 'This is an email to be sent"

Net::SMTP.start('hostname.domain.com', 25) do |smtp|
smtp.send_message(email,'(e-mail address removed)',
'(e-mail address removed)','(e-mail address removed)','(e-mail address removed)','(e-mail address removed)',
emailsto[index], emailcc[index])
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top