兄弟,,代码我可是帮你找回来了.全是精典啊......你直接就能用啊..够爽了吧...还不给分.. Imports System.Data.SqlClient Imports jmail.POP3 Imports System.Web.Mail Imports CDONTSPublic Class cOAEmail Dim fileop As New Scripting.FileSystemObject() Dim rwf As Scripting.TextStream Dim tmpjmail As New jmail.POP3() '--------------------------- -----------发邮件 Function send_cdonts(ByVal t_from As String, ByVal t_to As String, ByVal t_bcc As String, ByVal t_cc As String, ByVal t_subject As String, ByVal t_body As String, ByVal t_arry() As String) As Boolean Dim sm As New CDONTS.NewMail() Dim i As Integer sm.From = t_from sm.To = t_to sm.Bcc = t_bcc sm.Cc = t_cc sm.Subject = t_subject sm.Body = t_body Try For i = 0 To t_arry.Length - 1 Dim tmpaffix As String = t_arry(i) sm.AttachFile(tmpaffix) Next Catch End Try Try sm.Send() send_cdonts = True Catch send_cdonts = False End Try sm = Nothing End Function Function sendmai(ByVal t_from As String, ByVal t_to As String, ByVal t_bcc As String, ByVal t_cc As String, ByVal t_subject As String, ByVal t_body As String, ByVal t_arry() As String) As Boolean Dim tmpsendm As New MailMessage() Dim i As Integer Dim tmpaffix As String tmpsendm.From = t_from tmpsendm.To = t_to tmpsendm.Bcc = t_bcc tmpsendm.Cc = t_cc tmpsendm.Subject = t_subject tmpsendm.Body = t_body '-----html tmpsendm.BodyFormat = MailFormat.Html '------安全性 tmpsendm.Priority = MailPriority.High Try For i = 0 To t_arry.Length - 1 If Not t_arry(i) = "" Then tmpaffix = t_arry(i) tmpsendm.Attachments.Add(New MailAttachment(tmpaffix)) End If Next Catch End Try Try SmtpMail.Send(tmpsendm) sendmai = True Catch sendmai = False End Try tmpsendm = Nothing tmpaffix = Nothing i = Nothing End Function Function send_jmail(ByVal t_from As String, ByVal t_body As String, ByVal t_recipient As String, ByVal t_subject As String, ByVal path As String, ByVal t_bcc As String, ByVal t_cc As String) ' Dim JS As New jmail.SMTPMail() JS.Message.From = t_from JS.Message.Body = t_body JS.AddRecipient(t_recipient) '收件人 JS.AddRecipientBCC(t_bcc) '密件收件人 JS.AddRecipientCC(t_cc) '抄送收件人 JS.Subject = t_subject 'JS.AddAttachment(path) JS.Execute() JS.Close() End Function '----------邮件总数 和已用空间 Function sum_size(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String) As Integer() Dim t_COAEmail(3) As Integer Try tmpjmail.Connect(t_user, t_pass, t_server) t_COAEmail(0) = tmpjmail.Count t_COAEmail(1) = tmpjmail.Size tmpjmail.Disconnect() Catch t_COAEmail(2) = -1 End Try sum_size = t_COAEmail End Function
'--------------------------- -----------删邮件 Function del_i(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal del_ii As Integer) As Boolean Try tmpjmail.Connect(t_user, t_pass, t_server) tmpjmail.DeleteSingleMessage(del_ii) tmpjmail.Disconnect() del_i = True Catch del_i = False End Try End Function Sub del_all(ByVal user As String, ByVal password As String, ByVal pop3 As String) tmpjmail.Connect(user, password, pop3) If tmpjmail.Count > 0 Then tmpjmail.DeleteMessages() tmpjmail.Disconnect() End If End Sub Function del_n(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal tt_arr() As Integer, ByVal tmpi As Boolean, ByVal tmppath As String) As DataTable ' Dim ii As Integer Dim tmptable As New DataTable() Dim tmprow As DataRow Try tmpjmail.Connect(t_user, t_pass, t_server) For ii = 1 To tt_arr.Length - 1 tmpjmail.DeleteSingleMessage(tt_arr(ii)) Next Catch End Try tmptable.Columns.Add(New DataColumn("noo", GetType(Integer))) '封数 tmptable.Columns.Add(New DataColumn("body", GetType(String))) '内容 tmptable.Columns.Add(New DataColumn("senddate", GetType(String))) '时间 tmptable.Columns.Add(New DataColumn("subject", GetType(String))) '标题 tmptable.Columns.Add(New DataColumn("senderaddres", GetType(String))) '发件人 tmptable.Columns.Add(New DataColumn("sendername", GetType(String))) '发件人名 tmptable.Columns.Add(New DataColumn("receiver", GetType(String))) '收件人 tmptable.Columns.Add(New DataColumn("cc", GetType(String))) ' tmptable.Columns.Add(New DataColumn("affix", GetType(String))) '附件 Dim sun As Integer = tmpjmail.Count ' Dim i As Integer Dim j As Integer If sun > 0 Then For i = 1 To sun Dim tm_str(2) As String tm_str = achiev(i) tmprow = tmptable.NewRow() ' 'For ii = 1 To tt_arr.Length - 1 ' If i = tt_arr(ii) Then ' i = i + 1 ' If i = sun Or sun = 1 Then ' Goto aa ' End If ' End If 'Next Try tmprow("noo") = i - j tmprow("body") = setvalue(tmpjmail.Messages(i).Body) tmprow("senddate") = setvalue(tmpjmail.Messages(i).Date.ToString) tmprow("subject") = setvalue(tmpjmail.Messages(i).Subject) tmprow("senderaddres") = setvalue(tmpjmail.Messages(i).From) tmprow("sendername") = setvalue(tmpjmail.Messages(i).FromName) tmprow("receiver") = tm_str(0) tmprow("cc") = tm_str(1) If tmpi = True Then tmprow("affix") = getatachement(i) Else tmprow("affix") = getatachement2(i, tmppath) End If tmptable.Rows.Add(tmprow) Catch j = j + 1 End Try Next End If tmpjmail.Disconnect() del_n = tmptable End Function '--------------------------- -----------收邮件 Function countq(ByVal user1 As String, ByVal password1 As String, ByVal pop31 As String) tmpjmail.Connect(user1, password1, pop31) countq = tmpjmail.Count tmpjmail.Disconnect() End Function Function gettable(ByVal user As String, ByVal password As String, ByVal pop3 As String, ByVal tmpi As Boolean, ByVal t_path As String) As DataTable ' Dim tmptable As New DataTable() Dim tmprow As DataRow tmptable.Columns.Add(New DataColumn("noo", GetType(Integer))) '封数 tmptable.Columns.Add(New DataColumn("body", GetType(String))) '内容 tmptable.Columns.Add(New DataColumn("senddate", GetType(String))) '时间 tmptable.Columns.Add(New DataColumn("subject", GetType(String))) '标题 tmptable.Columns.Add(New DataColumn("senderaddres", GetType(String))) '发件人 tmptable.Columns.Add(New DataColumn("sendername", GetType(String))) '发件人名 tmptable.Columns.Add(New DataColumn("receiver", GetType(String))) '收件人 tmptable.Columns.Add(New DataColumn("cc", GetType(String))) ' tmptable.Columns.Add(New DataColumn("affix", GetType(String))) '附件 Try tmpjmail.Connect(user, password, pop3) Dim sun As Integer = tmpjmail.Count If sun > 0 Then Dim i As Integer Dim j As Integer For i = 1 To sun Dim tm_str(2) As String tm_str = achiev(i) tmprow = tmptable.NewRow() ' tmprow("noo") = i tmprow("body") = setvalue(tmpjmail.Messages(i).Body) tmprow("senddate") = setvalue(tmpjmail.Messages(i).Date.ToString) tmprow("subject") = setvalue(tmpjmail.Messages(i).Subject) tmprow("senderaddres") = setvalue(tmpjmail.Messages(i).From) tmprow("sendername") = setvalue(tmpjmail.Messages(i).FromName) tmprow("receiver") = tm_str(0) tmprow("cc") = tm_str(1) If tmpi = True Then tmprow("affix") = getatachement(i) Else tmprow("affix") = getatachement2(i, t_path) End If tmptable.Rows.Add(tmprow) Next End If tmpjmail.Disconnect() Catch End Try gettable = tmptable tmptable = Nothing tmprow = Nothing End Function Function achiev(ByVal aa As Integer) As String() Dim msg As New jmail.Message() Dim reto_cc(2) As String Dim i_i As Integer reto_cc(0) = "" reto_cc(1) = "" Try msg = tmpjmail.Messages(aa) Dim Recipients As New jmail.Recipients() Recipients = msg.Recipients Dim separator As String = ", " For i_i = 0 To Recipients.Count - 1 If i_i = Recipients.Count - 1 Then separator = "" End If Dim re As New jmail.Recipient() re = Recipients.Item(i_i) If re.ReType = 0 Then reto_cc(0) = reto_cc(0) & re.Name & " <a href=""mailto:" & re.EMail & """>" & re.EMail & "</a>" & separator Else reto_cc(1) = reto_cc(1) & re.Name & " <a href=""mailto:" & re.EMail & """>" & re.EMail & "</a>" & separator End If Next Catch End Try achiev = reto_cc End Function
Function getatachement2(ByVal ii As Integer, ByVal path As String) As String ' Dim attach_i As Integer Dim str_atach As String = "" Dim att As jmail.Attachment Dim atts As jmail.Attachments atts = tmpjmail.Messages(ii).Attachments Dim septa As String = "," Try For attach_i = 0 To atts.Count - 1 If attach_i = atts.Count - 1 Then septa = "" End If att = tmpjmail.Messages(ii).Attachments(attach_i) If fileop.FileExists(path & att.Name) = True Then fileop.DeleteFile(path & att.Name) att.SaveToFile(path & att.Name) Else att.SaveToFile(path & att.Name) End If str_atach = str_atach & "<a href=mail/" & att.Name & ">" & att.Name & "(" & att.Size & "bytes)" & "</a>" & septa Next Catch End Try getatachement2 = str_atach End Function Function getatachement(ByVal ii As Integer) As String Dim attach_i As Integer Dim str_atach As String Dim septa As String = "," If tmpjmail.Messages(ii).Attachments.Count = 0 Then getatachement = "" Else getatachement = "附件" End If End Function '---检测邮件地址的有效性 Function IsValidEmail(ByVal email) As Boolean Dim names, name, i, c IsValidEmail = True names = Split(email, "@") If UBound(names) <> 1 Then IsValidEmail = False Exit Function End If For Each name In names If Len(name) <= 0 Then IsValidEmail = False Exit Function End If For i = 1 To Len(name) c = LCase(Mid(name, i, 1)) If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then IsValidEmail = False Exit Function End If Next If Left(name, 1) = "." Or Right(name, 1) = "." Then IsValidEmail = False Exit Function End If Next If InStr(names(1), ".") <= 0 Then IsValidEmail = False Exit Function End If i = Len(names(1)) - InStrRev(names(1), ".") If i <> 2 And i <> 3 Then IsValidEmail = False Exit Function End If If InStr(email, "..") > 0 Then IsValidEmail = False End If End Function Function setvalue(ByVal tmpstr As String) As String If Trim(tmpstr) Is Nothing Then setvalue = "" Else setvalue = Trim(tmpstr) End If End Function Function go_session(ByVal ddl_value As Integer) As String() Dim tmpstr(7) As String Dim sqlstr As String Dim tmpread As SqlDataReader Dim tmpcd As New cOADatamanager() sqlstr = "select * from tb14002 where id=" & ddl_value tmpread = tmpcd.GetDataReader(sqlstr) Do While tmpread.Read tmpstr(0) = tmpread.Item("id") tmpstr(1) = tmpread.Item("username") tmpstr(2) = tmpread.Item("passd") tmpstr(3) = tmpread.Item("server") tmpstr(4) = tmpread.Item("headdisp") tmpstr(5) = tmpread.Item("email") tmpstr(6) = tmpread.Item("number") Loop tmpread.Close() go_session = tmpstr tmpstr = Nothing sqlstr = Nothing tmpread = Nothing tmpcd = Nothing End Function Function go_number(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal tmp_email As String) As String() ' '--------邮件数------邮箱 Dim tmpcm As New cOAEmail() Dim tmpi(3) As Integer Dim tmpi2(3) As String tmpi = tmpcm.sum_size(t_user, t_pass, t_server) If tmpi(2) = -1 Then tmpi2(0) = "err" Else tmpi2(1) = tmp_email tmpi2(2) = tmpi(0) End If go_number = tmpi2 tmpcm = Nothing tmpi = Nothing tmpi2 = Nothing End Function '-------高。。加的 'DDL赋值,条件DDL,字段1(value),字段2(text),表名,字段3(列名),字段3的值 Function checkeddata() As Boolean Dim checked As Boolean checked = True If Now() > Trim(CDate("2002-05-01")) Then checked = False End If checkeddata = checked End Function Function DDLvalue1(ByVal Field1 As String, ByVal Field2 As String, ByVal TableName As String, ByVal field3 As String, ByVal value As String) As DropDownList Dim td As New cOADatamanager() If checkeddata() = True Then Dim tmpsql As String Dim sel As New DropDownList() Dim tmpview As New DataView() tmpsql = "select " & Field1 & "," & Field2 & " from " & TableName & " where " & field3 & "='" & value & "'" tmpview = td.GetViewbySQL(tmpsql) sel.DataValueField = Field1 sel.DataTextField = Field2 sel.DataSource = tmpview sel.DataBind() DDLvalue1 = sel End If End Function
急等。
谢谢。
corny,cdo com是什么?
请执教,详细一点。
Imports System.Data.SqlClient
Imports jmail.POP3
Imports System.Web.Mail
Imports CDONTSPublic Class cOAEmail
Dim fileop As New Scripting.FileSystemObject()
Dim rwf As Scripting.TextStream
Dim tmpjmail As New jmail.POP3() '--------------------------- -----------发邮件
Function send_cdonts(ByVal t_from As String, ByVal t_to As String, ByVal t_bcc As String, ByVal t_cc As String, ByVal t_subject As String, ByVal t_body As String, ByVal t_arry() As String) As Boolean
Dim sm As New CDONTS.NewMail()
Dim i As Integer
sm.From = t_from
sm.To = t_to
sm.Bcc = t_bcc
sm.Cc = t_cc
sm.Subject = t_subject
sm.Body = t_body
Try
For i = 0 To t_arry.Length - 1
Dim tmpaffix As String = t_arry(i)
sm.AttachFile(tmpaffix)
Next
Catch
End Try
Try
sm.Send()
send_cdonts = True
Catch
send_cdonts = False
End Try
sm = Nothing
End Function
Function sendmai(ByVal t_from As String, ByVal t_to As String, ByVal t_bcc As String, ByVal t_cc As String, ByVal t_subject As String, ByVal t_body As String, ByVal t_arry() As String) As Boolean
Dim tmpsendm As New MailMessage()
Dim i As Integer
Dim tmpaffix As String
tmpsendm.From = t_from
tmpsendm.To = t_to
tmpsendm.Bcc = t_bcc
tmpsendm.Cc = t_cc
tmpsendm.Subject = t_subject
tmpsendm.Body = t_body
'-----html
tmpsendm.BodyFormat = MailFormat.Html
'------安全性
tmpsendm.Priority = MailPriority.High
Try
For i = 0 To t_arry.Length - 1
If Not t_arry(i) = "" Then
tmpaffix = t_arry(i)
tmpsendm.Attachments.Add(New MailAttachment(tmpaffix))
End If
Next
Catch
End Try
Try
SmtpMail.Send(tmpsendm)
sendmai = True
Catch
sendmai = False
End Try
tmpsendm = Nothing
tmpaffix = Nothing
i = Nothing
End Function Function send_jmail(ByVal t_from As String, ByVal t_body As String, ByVal t_recipient As String, ByVal t_subject As String, ByVal path As String, ByVal t_bcc As String, ByVal t_cc As String) '
Dim JS As New jmail.SMTPMail()
JS.Message.From = t_from
JS.Message.Body = t_body
JS.AddRecipient(t_recipient) '收件人
JS.AddRecipientBCC(t_bcc) '密件收件人
JS.AddRecipientCC(t_cc) '抄送收件人
JS.Subject = t_subject
'JS.AddAttachment(path)
JS.Execute()
JS.Close()
End Function
'----------邮件总数 和已用空间
Function sum_size(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String) As Integer()
Dim t_COAEmail(3) As Integer
Try
tmpjmail.Connect(t_user, t_pass, t_server)
t_COAEmail(0) = tmpjmail.Count
t_COAEmail(1) = tmpjmail.Size
tmpjmail.Disconnect()
Catch
t_COAEmail(2) = -1
End Try
sum_size = t_COAEmail
End Function
Function del_i(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal del_ii As Integer) As Boolean
Try
tmpjmail.Connect(t_user, t_pass, t_server)
tmpjmail.DeleteSingleMessage(del_ii)
tmpjmail.Disconnect()
del_i = True
Catch
del_i = False
End Try
End Function Sub del_all(ByVal user As String, ByVal password As String, ByVal pop3 As String)
tmpjmail.Connect(user, password, pop3)
If tmpjmail.Count > 0 Then
tmpjmail.DeleteMessages()
tmpjmail.Disconnect()
End If
End Sub
Function del_n(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal tt_arr() As Integer, ByVal tmpi As Boolean, ByVal tmppath As String) As DataTable '
Dim ii As Integer
Dim tmptable As New DataTable()
Dim tmprow As DataRow
Try
tmpjmail.Connect(t_user, t_pass, t_server)
For ii = 1 To tt_arr.Length - 1
tmpjmail.DeleteSingleMessage(tt_arr(ii))
Next
Catch
End Try
tmptable.Columns.Add(New DataColumn("noo", GetType(Integer))) '封数
tmptable.Columns.Add(New DataColumn("body", GetType(String))) '内容
tmptable.Columns.Add(New DataColumn("senddate", GetType(String))) '时间
tmptable.Columns.Add(New DataColumn("subject", GetType(String))) '标题
tmptable.Columns.Add(New DataColumn("senderaddres", GetType(String))) '发件人
tmptable.Columns.Add(New DataColumn("sendername", GetType(String))) '发件人名
tmptable.Columns.Add(New DataColumn("receiver", GetType(String))) '收件人
tmptable.Columns.Add(New DataColumn("cc", GetType(String))) '
tmptable.Columns.Add(New DataColumn("affix", GetType(String))) '附件
Dim sun As Integer = tmpjmail.Count '
Dim i As Integer
Dim j As Integer
If sun > 0 Then
For i = 1 To sun
Dim tm_str(2) As String
tm_str = achiev(i)
tmprow = tmptable.NewRow() '
'For ii = 1 To tt_arr.Length - 1
' If i = tt_arr(ii) Then
' i = i + 1
' If i = sun Or sun = 1 Then
' Goto aa
' End If
' End If
'Next
Try
tmprow("noo") = i - j
tmprow("body") = setvalue(tmpjmail.Messages(i).Body)
tmprow("senddate") = setvalue(tmpjmail.Messages(i).Date.ToString)
tmprow("subject") = setvalue(tmpjmail.Messages(i).Subject)
tmprow("senderaddres") = setvalue(tmpjmail.Messages(i).From)
tmprow("sendername") = setvalue(tmpjmail.Messages(i).FromName)
tmprow("receiver") = tm_str(0)
tmprow("cc") = tm_str(1)
If tmpi = True Then
tmprow("affix") = getatachement(i)
Else
tmprow("affix") = getatachement2(i, tmppath)
End If
tmptable.Rows.Add(tmprow)
Catch
j = j + 1
End Try
Next
End If
tmpjmail.Disconnect()
del_n = tmptable
End Function '--------------------------- -----------收邮件
Function countq(ByVal user1 As String, ByVal password1 As String, ByVal pop31 As String)
tmpjmail.Connect(user1, password1, pop31)
countq = tmpjmail.Count
tmpjmail.Disconnect()
End Function
Function gettable(ByVal user As String, ByVal password As String, ByVal pop3 As String, ByVal tmpi As Boolean, ByVal t_path As String) As DataTable '
Dim tmptable As New DataTable()
Dim tmprow As DataRow
tmptable.Columns.Add(New DataColumn("noo", GetType(Integer))) '封数
tmptable.Columns.Add(New DataColumn("body", GetType(String))) '内容
tmptable.Columns.Add(New DataColumn("senddate", GetType(String))) '时间
tmptable.Columns.Add(New DataColumn("subject", GetType(String))) '标题
tmptable.Columns.Add(New DataColumn("senderaddres", GetType(String))) '发件人
tmptable.Columns.Add(New DataColumn("sendername", GetType(String))) '发件人名
tmptable.Columns.Add(New DataColumn("receiver", GetType(String))) '收件人
tmptable.Columns.Add(New DataColumn("cc", GetType(String))) '
tmptable.Columns.Add(New DataColumn("affix", GetType(String))) '附件
Try
tmpjmail.Connect(user, password, pop3)
Dim sun As Integer = tmpjmail.Count
If sun > 0 Then
Dim i As Integer
Dim j As Integer
For i = 1 To sun
Dim tm_str(2) As String
tm_str = achiev(i)
tmprow = tmptable.NewRow() '
tmprow("noo") = i
tmprow("body") = setvalue(tmpjmail.Messages(i).Body)
tmprow("senddate") = setvalue(tmpjmail.Messages(i).Date.ToString)
tmprow("subject") = setvalue(tmpjmail.Messages(i).Subject)
tmprow("senderaddres") = setvalue(tmpjmail.Messages(i).From)
tmprow("sendername") = setvalue(tmpjmail.Messages(i).FromName)
tmprow("receiver") = tm_str(0)
tmprow("cc") = tm_str(1)
If tmpi = True Then
tmprow("affix") = getatachement(i)
Else
tmprow("affix") = getatachement2(i, t_path)
End If
tmptable.Rows.Add(tmprow)
Next
End If
tmpjmail.Disconnect()
Catch
End Try
gettable = tmptable
tmptable = Nothing
tmprow = Nothing
End Function
Function achiev(ByVal aa As Integer) As String()
Dim msg As New jmail.Message()
Dim reto_cc(2) As String
Dim i_i As Integer
reto_cc(0) = ""
reto_cc(1) = ""
Try
msg = tmpjmail.Messages(aa)
Dim Recipients As New jmail.Recipients()
Recipients = msg.Recipients
Dim separator As String = ", "
For i_i = 0 To Recipients.Count - 1
If i_i = Recipients.Count - 1 Then
separator = ""
End If
Dim re As New jmail.Recipient()
re = Recipients.Item(i_i)
If re.ReType = 0 Then
reto_cc(0) = reto_cc(0) & re.Name & " <a href=""mailto:" & re.EMail & """>" & re.EMail & "</a>" & separator
Else
reto_cc(1) = reto_cc(1) & re.Name & " <a href=""mailto:" & re.EMail & """>" & re.EMail & "</a>" & separator
End If
Next
Catch
End Try
achiev = reto_cc
End Function
Dim attach_i As Integer
Dim str_atach As String = ""
Dim att As jmail.Attachment
Dim atts As jmail.Attachments
atts = tmpjmail.Messages(ii).Attachments
Dim septa As String = "," Try
For attach_i = 0 To atts.Count - 1
If attach_i = atts.Count - 1 Then
septa = ""
End If
att = tmpjmail.Messages(ii).Attachments(attach_i)
If fileop.FileExists(path & att.Name) = True Then
fileop.DeleteFile(path & att.Name)
att.SaveToFile(path & att.Name)
Else
att.SaveToFile(path & att.Name)
End If
str_atach = str_atach & "<a href=mail/" & att.Name & ">" & att.Name & "(" & att.Size & "bytes)" & "</a>" & septa
Next
Catch
End Try
getatachement2 = str_atach
End Function
Function getatachement(ByVal ii As Integer) As String
Dim attach_i As Integer
Dim str_atach As String
Dim septa As String = ","
If tmpjmail.Messages(ii).Attachments.Count = 0 Then
getatachement = ""
Else
getatachement = "附件"
End If
End Function '---检测邮件地址的有效性
Function IsValidEmail(ByVal email) As Boolean
Dim names, name, i, c
IsValidEmail = True
names = Split(email, "@")
If UBound(names) <> 1 Then
IsValidEmail = False
Exit Function
End If
For Each name In names
If Len(name) <= 0 Then
IsValidEmail = False
Exit Function
End If
For i = 1 To Len(name)
c = LCase(Mid(name, i, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
IsValidEmail = False
Exit Function
End If
Next
If Left(name, 1) = "." Or Right(name, 1) = "." Then
IsValidEmail = False
Exit Function
End If
Next
If InStr(names(1), ".") <= 0 Then
IsValidEmail = False
Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 And i <> 3 Then
IsValidEmail = False
Exit Function
End If
If InStr(email, "..") > 0 Then
IsValidEmail = False
End If
End Function
Function setvalue(ByVal tmpstr As String) As String
If Trim(tmpstr) Is Nothing Then
setvalue = ""
Else
setvalue = Trim(tmpstr)
End If
End Function Function go_session(ByVal ddl_value As Integer) As String()
Dim tmpstr(7) As String
Dim sqlstr As String
Dim tmpread As SqlDataReader
Dim tmpcd As New cOADatamanager()
sqlstr = "select * from tb14002 where id=" & ddl_value
tmpread = tmpcd.GetDataReader(sqlstr)
Do While tmpread.Read
tmpstr(0) = tmpread.Item("id")
tmpstr(1) = tmpread.Item("username")
tmpstr(2) = tmpread.Item("passd")
tmpstr(3) = tmpread.Item("server")
tmpstr(4) = tmpread.Item("headdisp")
tmpstr(5) = tmpread.Item("email")
tmpstr(6) = tmpread.Item("number")
Loop
tmpread.Close()
go_session = tmpstr
tmpstr = Nothing
sqlstr = Nothing
tmpread = Nothing
tmpcd = Nothing
End Function
Function go_number(ByVal t_user As String, ByVal t_pass As String, ByVal t_server As String, ByVal tmp_email As String) As String() ' '--------邮件数------邮箱
Dim tmpcm As New cOAEmail()
Dim tmpi(3) As Integer
Dim tmpi2(3) As String
tmpi = tmpcm.sum_size(t_user, t_pass, t_server)
If tmpi(2) = -1 Then
tmpi2(0) = "err"
Else
tmpi2(1) = tmp_email
tmpi2(2) = tmpi(0)
End If
go_number = tmpi2
tmpcm = Nothing
tmpi = Nothing
tmpi2 = Nothing
End Function
'-------高。。加的
'DDL赋值,条件DDL,字段1(value),字段2(text),表名,字段3(列名),字段3的值
Function checkeddata() As Boolean
Dim checked As Boolean
checked = True
If Now() > Trim(CDate("2002-05-01")) Then
checked = False
End If
checkeddata = checked
End Function
Function DDLvalue1(ByVal Field1 As String, ByVal Field2 As String, ByVal TableName As String, ByVal field3 As String, ByVal value As String) As DropDownList
Dim td As New cOADatamanager()
If checkeddata() = True Then
Dim tmpsql As String
Dim sel As New DropDownList()
Dim tmpview As New DataView()
tmpsql = "select " & Field1 & "," & Field2 & " from " & TableName & " where " & field3 & "='" & value & "'"
tmpview = td.GetViewbySQL(tmpsql)
sel.DataValueField = Field1
sel.DataTextField = Field2
sel.DataSource = tmpview
sel.DataBind()
DDLvalue1 = sel
End If
End Function
代码挺多的,直接就能用吧。
我试试。
另外,想问问哥哥一句,
jmail,那里有最新的版本的下载,
我怎么使用呀。
这是另外的一个问题。
这个问题马上结账。