Ruby Net :: SMTP - send email using bcc: recipients

I want to use Ruby Net :: SMTP to send email. Subprogramme

send_message( msgstr, from_addr, *to_addrs ) 

works well in my code to send email but from this

+7
ruby email-integration bcc
source share
2 answers

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.

+15
source share

Yes, this is not possible with Net :: STMP. But there is a really nice stone for managing email sending ( http://github.com/mikel/mail ). I recommend you use it.

+2
source share

All Articles