//************************************** // Name: A VB.NET sample showing how to send emails to recipients // Description:This Console application, written in Visual Basic .NET, shows how to send (multiple) email messages to (multiple) recipients. Code sample is simple. However, advanced features like embedded attachments, rich text formatting etc. are possible // By: Roby Kott (from psc cd) // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** ' Description:Send email(s) to an SMTP s // erver, ' to multiple recipients, with attachmen // ts etc. ' Easy to use, no IIS or MS SMTP service // required. // ' ' You need the FREEWARE AEmail.dll to ru // n the sample. ' Download it from http://www.vahland.co // m/pub/aemail.dll // ' and register it on your machine. ' Then, choose 'Add Reference' from your // Solutions Window, ' and 'Add' the 'ActivEmail 2.1 Type Lib // rary'. // ' ' Read http://www.vahland.com/pub/aemail // .htm for more info. Imports AEMAILLib Module Module1 Sub Main() Dim objSmtpMail As AEMAILLib.SmtpMailClass Console.WriteLine("Be sure To have the FREEWARE AEmail.dll registered on your system,") Console.WriteLine("and add the ActivEmail 2.1 Type Library to your references.") Console.WriteLine("Check out the code header about how to obtain the free component.") Console.WriteLine("") objSmtpMail = New AEMAILLib.SmtpMailClass() objSmtpMail.HostName = "yourmailserver.yourdomain.dom" objSmtpMail.FromName = "Senders Name" objSmtpMail.FromAddress = "sender@sendersdomain.dom" objSmtpMail.AddTo("john.doe@domain.dom", "John Doe") objSmtpMail.Subject = "My Subject" ' If you want, you can include attachmen // t, multiple recipients, rich text format // ting etc. ' It's not included in this sample to ke // ep sample straight. objSmtpMail.Body = "Here is the body text" & vbCrLf & "Best regards..." objSmtpMail.Send() Console.WriteLine("Send, result: " & objSmtpMail.LastError.ToString()) objSmtpMail.Clear() ' To use the same object again with all properties cleared End Sub End Module