Send Email To Multiple Recipients | Blog - Limilabs

Limilabs
  • Products
  • Services
  • Support
  • Blog
  • About us
Limilabs
  • Products
  • Services
  • Support
  • Blog
  • About us
Send email to multiple recipients

In this post we’ll show how to send email message to multiple recipients.

If your email should look differently for each recipient (customized “Hello [FirstName] [LastName]” message) take a look at:

  • Email template engine
  • VERP (Variable Envelope Return Path)

If your email looks exactly the same for each recipient the easiest way is to use BCC field (Blind-Carbon-Copy), and specify Undisclosed recipients group as the message recipient:

MailBuilder builder = new MailBuilder(); builder.From.Add(new MailBox("[email protected]", "Alice")); builder.To.Add(new MailGroup("Undisclosed recipients")); builder.Bcc.Add(new MailBox("[email protected]", "Bob")); builder.Bcc.Add(new MailBox("[email protected]", "Tom")); builder.Bcc.Add(new MailBox("[email protected]", "John"));

Here’s entire sample, that creates email message, connects to SMTP server and sends the message:

// C# version MailBuilder builder = new MailBuilder(); builder.From.Add(new MailBox("[email protected]", "Alice")); builder.To.Add(new MailGroup("Undisclosed recipients")); builder.Bcc.Add(new MailBox("[email protected]", "Bob")); builder.Bcc.Add(new MailBox("[email protected]", "Tom")); builder.Bcc.Add(new MailBox("[email protected]", "John")); builder.Subject = "Put subject here"; builder.Html = "Put <strong>HTML</strong> message here."; // Plain text is automatically generated, but you can change it: //builder.Text = "Put plain text message here."; IMail email = builder.Create(); // Send the message using (Smtp smtp = new Smtp()) { smtp.Connect("server.example.com"); // or ConnectSSL for SSL smtp.UseBestLogin("user", "password"); // remove if not needed smtp.SendMessage(email); smtp.Close(); } ' VB.NET version Dim builder As New MailBuilder() builder.From.Add(New MailBox("[email protected]", "Alice")) builder.[To].Add(New MailGroup("Undisclosed recipients")) builder.Bcc.Add(New MailBox("[email protected]", "Bob")) builder.Bcc.Add(New MailBox("[email protected]", "Tom")) builder.Bcc.Add(New MailBox("[email protected]", "John")) builder.Subject = "Put subject here" builder.Htm = "Put <strong>HTML</strong> message here." ' Plain text is automatically generated, but you can change it: 'builder.Text ="Put plain text message here." Dim email As IMail = builder.Create() ' Send the message Using smtp As New Smtp() smtp.Connect("server.example.com") ' or ConnectSSL for SSL smtp.UseBestLogin("user", "password") ' remove if not needed smtp.SendMessage(email) smtp.Close() End Using

Tags: Email component SMTP

Questions?

Consider using our Q&A forum for asking questions.
  • .NET components

    • Barcode.dll barcode component
    • Ftp.dll FTP/FTPS component
    • Mail.dll email component

Blog

  • Entries (RSS)

Contact

Limilabs™

VAT: PL 5213195875 Regon: 145938780 Pulawska 115/18 02-707, Warsaw Poland

Limilabs™ © 2004-2025. All rights reserved. | Terms of Use | Privacy Policy

Từ khóa » Visual Basic Send Email Multiple Recipients