The to_addrs send_message points the envelope to addresses. Including an address in to_addrs does not affect the to and cc addresses that are included in the message header.
For the bcc recipient, specify the address in the to_addrs parameter, but do not include it in the headers in msgstr . For example:
msgstr = <<EOF From: from@example.org To: to@example.org Cc: cc@example.org Subject: Test BCC This is a test message. EOF Net::SMTP.start(smtp_server, 25) do |smtp| smtp.send_message msgstr, 'from@example.org', 'to@example.org', 'cc@example.org', 'bcc@example.org' end
This will send an email to three recipients: to@example.org, cc@example.org and bcc@example.org. Only the email address com@example.org and cc@example.org will be displayed in the received message.
Phil ross
source share