您的位置:建站学院首页 >> 文章 >> asp.net >> VB.Net语言
一个不需要CDO和IIS发送邮件的例子

下面的例子是转载国外的,可以实现不使用CDO和IIS发送邮件。说明:本例子没有经过测试,原地址在:
http://www.dotnetforums.net/t81508.html

VB.NET:


Imports System
Imports System.Text
Imports System.Windows.Forms
Public Class cSMTP
    Private m_sSender As String
    Private m_sUser As String
    Private m_sSenderName As String
    Private m_sRecipient As String
    Private m_sRecipientName As String
    Private m_sServer As String
    Private m_iPort As Integer
    Private m_sSubject As String
    Private m_sBody As String

    Private m_iTimeOut As Integer
    Private m_colCC As Collection
    Private m_colCC_OK As Collection

    Private Structure TRecipient
        Dim strEMail As String
        Dim strName As String
        Dim bBlind As Boolean
    End Structure

    Private tcpClient As System.Net.Sockets.TcpClient
    Private networkStream As System.Net.Sockets.NetworkStream

    Public Property Timeout() As Integer
        Get
            Timeout = m_iTimeOut
        End Get
        Set(ByVal Value As Integer)
            m_iTimeOut = Value
        End Set
    End Property

    Public Property User() As String
        Get
            User = m_sUser
        End Get
        Set(ByVal s As String)
            m_sUser = s
        End Set
    End Property

    Public Property Subject() As String
        Get
            Subject = m_sSubject
        End Get
        Set(ByVal s As String)
            m_sSubject = s
        End Set
    End Property

    Public Property Body() As String
        Get
            Body = m_sBody
        End Get
        Set(ByVal s As String)
            m_sBody = s
        End Set
    End Property

    Public Property Sender() As String
        Get
            Sender = m_sSender
        End Get
        Set(ByVal s As String)
            m_sSender = s
        End Set
    End Property

    Public Property SenderName() As String
        Get
            SenderName = m_sSenderName
        End Get
        Set(ByVal s As String)
            m_sSenderName = s
        End Set
    End Property

    Public Property Recipient() As String
        Get
            Recipient = m_sRecipient
        End Get
        Set(ByVal s As String)
            m_sRecipient = s
        End Set
    End Property

    Public Property RecipientName() As String
        Get
            RecipientName = m_sRecipientName
        End Get
        Set(ByVal s As String)
            m_sRecipientName = s
        

本内容共6页  首 页  上一页  下一页  尾 页  当前在第1

Google
 
Web www.cqxw.net