VB.NET Send email using CDOSYS

Utilizing CDOSYS presents a straightforward approach for sending emails from VB.NET. However, it's important to note that this method requires sending emails from Windows 2000/XP operating systems. Additionally, the SMTP Service in IIS (Internet Information Services) needs to be enabled to facilitate the email sending process.

By using CDOSYS, developers can seamlessly integrate email functionality into their VB.NET applications. This method offers simplicity and convenience, allowing for efficient email transmission without the need for complex configurations or dependencies on external libraries.

Requirements

To utilize CDOSYS for sending emails, the following prerequisites must be met:

  1. Windows XP/ Windows2000
  2. Internet Information Services (IIS)
  3. SMTP Services in IIS should be enable.

Once these prerequisites are in place, developers can proceed with implementing the email sending functionality using CDOSYS in their VB.NET applications. This method offers a straightforward and reliable approach to send emails, making it an attractive option for many scenarios.

Full Source VB.NET
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CDOSYS As Object Const cdoSendUsingPickup = 1 Const strPickup = "c:\inetpub\mailroot\pickup" CDOSYS = CreateObject("CDO.Message") CDOSYS.Configuration.Fields.item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") _ = cdoSendUsingPickup CDOSYS.Configuration.Fields.item _ ("http://schemas.microsoft.com/cdo/configuration" & _ /smtpserverpickupdirectory") _ = strPickup CDOSYS.Configuration.Fields.Update() CDOSYS.To = "TO ADDRESS" CDOSYS.From = "FROM ADDRESS" CDOSYS.Subject = "CDO Test" CDOSYS.TextBody = "Send Email from vb.net using CDOSYS" CDOSYS.Send() CDOSYS = Nothing MsgBox("mail send") End Sub End Class

Conclusion

By adhering to these requirements and using CDOSYS, VB.NET developers can utilize the power of email communication within their applications, enhancing user experiences and enabling efficient information exchange.