Add Multiple Recipient to send out emails through rabbitmq-email plugin

44 views
Skip to first unread message

arvind...@gmail.com

unread,
Jul 20, 2018, 11:17:58 AM7/20/18
to rabbitmq-users
Dear RabbitMQCommunity,


I'm using the rabbitmq-email plugin to send emails. I configured the rabbitmq-email plugin and gen_smtp as well and it is working fine.
Although I'm able to send emails to single user. But I want to send emails to multiple users. 

According to this link: we can add "CC" as key in message properties having list of array values. but it is not working for me. This is how I'm publishing the message with recipient address as routing key (te...@gmail.com) and another email address in "cc" i.e (te...@gmail.com)

 using (var advancedBus = RabbitHutch.CreateBus(CONNECTION_STRING).Advanced)
            {
                var exchange = advancedBus.ExchangeDeclare("SubscriptionErrorExchange", ExchangeType.Direct);
                var queue = advancedBus.QueueDeclare("SubscriptionErrorQueue");
                advancedBus.Bind(exchange, queue, "te...@gmail.com");

                var props = new MessageProperties
                {
                    ContentType = "text/plain",
                    Headers = new Dictionary<string, object>
                    {
                            { "subject", "Testing Email" },
                            { "CC", new string[] { "te...@gmail.com" } }
                    }
                };

                var result = ObjectToByteArray(message);
                advancedBus.Publish(exchange, "te...@gmail.com", false, props, result);    
     }

Can we send emails to multiple recipients? 


Thanks & Regards

Arvind
Reply all
Reply to author
Forward
0 new messages