[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Net/SMTP Question

Lovell Mcilwain

8/9/2007 2:12:00 PM

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,'myemail@domain.com',
'myemail@domain.com','mail2@domain.com','mail3@domain.com','mail4@domain.com',
emailsto[index], emailcc[index])
end