| |
33.26.2.Email: to, cc, bcc, subject, body and attachment |
|
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);
}
}
|
|
33.26.EMail | | 33.26.1. | Send an email out | | | | 33.26.2. | Email: to, cc, bcc, subject, body and attachment | | |
|