Version: 3.2.1.0
Send, receive, edit, sign/verify and encrypt/decrypt email messages in any .NET application or service. 

Send Email Code Example

The following example demonstrates the creation and sending of an email message using the PowerTCP Smtp component. Progress is provided during the send.

< Back to all samples for PowerTCP Mail for .NET

private void sendEmail_Click(object sender, EventArgs e)
{
    //Create an email message.
    MessageStream msg = new MessageStream();
    msg.To.Add(new MailAddress("myRecipient@gmail.com"));
    msg.From = new MailAddress("me@dart.com");
    msg.Subject = "This is a PowerTCP Mail demonstrative message!";

    //Add some text.
    string content = "Hi, just a quick message to help demonstrate ";
    content += "the sending capabilities of PowerTCP Mail for .NET!";
    content += "Oh, and I've included a cool pic with this message!";
    msg.Text = content;

    //Add an attachment.
    msg.Attachments.Add("c:\\Images\\myImage.jpg");

    //Send the email.
    smtp1.Server = "mail.dart.com";
    smtp1.Send(msg);
    smtp1.Close();
    MessageBox.Show("DONE!");
}

private void smtp1_Progress(object sender, ProgressEventArgs e)
{
    //Show progress as the message is sent.
    progressBar.Maximum = 100;
    progressBar.Value = (int)((e.Position * 100) / e.Length);
}