PowerTCP Mail for .NET
Sending Mail Simply
Send comments on this topic.



Glossary Item Box

Mail can be sent using PowerTCP Mail for .NET with only a few lines of code. In fact, for the simplest method of sending, no knowledge of message format is required at all. The following example demonstrates the quickest and easiest way a simple text message can be sent using PowerTCP Mail for .NET.

To quickly and easily send a simple text message.

  1. Add the Smtp component to a new form.
  2. Add a button to the form.
  3. Specify your SMTP mail server. Do this by setting the Server property. The following code demonstrates setting the Server property. For the purposes of this walk-through, simply put this code in the click event of the button you added to the form in step 1.
    C# Copy Code
    smtp1.Server = "mail.myserver.com";
    Visual Basic Copy Code
    Smtp1.Server = "mail.myserver.com"
  4. Use the Smtp.Send method, passing in the "to" email address, the "from" email address, the subject, and the message itself. The following code demonstrates the use of the Smtp.Send method to send a quick text message. Place this code directly after the code from step 3.
    C# Copy Code
    smtp1.Send("you@test.com", "me@test.com", "Test", "This is a test message!");
    Visual Basic Copy Code
    Smtp1.Send("you@test.com", "me@test.com", "Test", "This is a test message!")
  5. Compile and run the application. Check the inbox of the email address that the message was sent to. There should be a new message.
Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.