MailMessage.Bcc : MailMessage « System.Net.Mail « C# / C Sharp by API






MailMessage.Bcc

  

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Mail;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;

public class MainClass
{
    public static void Main()
    {
        SmtpClient client = new SmtpClient("smtp.localhost.com");

        client.Credentials =new NetworkCredential("username", "password");

        MailMessage message = new MailMessage(new MailAddress("joe@net.com", "Joe"),    // To
            new MailAddress("raj@web.com", "Ray")); // CC
        message.Bcc.Add(new MailAddress("a@asdf.com"));
        message.Bcc.Add(new MailAddress("m@fda.com"));
        message.Subject = "subject";
        message.Body = "body";

        Attachment att = new Attachment(@"c:\file.cs");
        message.Attachments.Add(att);

        client.Send(message);
    }
}

   
    
  








Related examples in the same category

1.MailMessage.Attachments
2.MailMessage.Body
3.MailMessage.BodyFormat
4.MailMessage.From
5.MailMessage.Headers.Add
6.MailMessage.Priority
7.MailMessage.Subject
8.MailMessage.To