Public Function SendMail() As String
Dim conf As New CDO.ConfigurationClass()
Dim strEmailAddr As String
Dim strReturn As String
Dim array_strAttachment() As String = Split(strAttachment, ",")
Dim i As Integer
strEmailAddr = p_strSmtp.Replace("smtp.", p_strUserName & "@")
Try
conf.Fields(CdoConfiguration.cdoSendUsingMethod).Value = CdoSendUsing.cdoSendUsingPort
conf.Fields(CdoConfiguration.cdoSMTPServer).Value = p_strSmtp
conf.Fields(CdoConfiguration.cdoSMTPServerPort).Value = p_nSmtpPort
conf.Fields(CdoConfiguration.cdoSMTPAccountName).Value = p_strUserName
conf.Fields(CdoConfiguration.cdoSendUserReplyEmailAddress).Value = """" + p_strUserName + """<" + strEmailAddr + ">" + ""
conf.Fields(CdoConfiguration.cdoSendEmailAddress).Value = """" + p_strUserName + """<" + strEmailAddr + ">" + ""
conf.Fields(CdoConfiguration.cdoSMTPAuthenticate).Value = CdoProtocolsAuthentication.cdoBasic
conf.Fields(CdoConfiguration.cdoSendUserName).Value = p_strUserName
conf.Fields(CdoConfiguration.cdoSendPassword).Value = p_strPSW
conf.Fields.Update() Dim msg As New MessageClass()
msg.Configuration = conf
msg.To = p_strReceiver
If Len(p_strCC) >= 0 Then
msg.CC = p_strCC
End If
msg.Subject = p_strSubject
msg.From = strEmailAddr
For i = 1 To array_strAttachment.Length
msg.AddAttachment(array_strAttachment(i - 1))
Next
If p_bHtml Then
msg.HTMLBody = p_strBody
Else
msg.TextBody = p_strBody
End If
msg.Send()
strReturn = p_strReceiver & "发送成功" & Now
Catch er As System.Runtime.InteropServices.COMException
strReturn = p_strReceiver & "发送失败" & Now
End Try
Return strReturn
End Function
Dim conf As New CDO.ConfigurationClass()
Dim strEmailAddr As String
Dim strReturn As String
Dim array_strAttachment() As String = Split(strAttachment, ",")
Dim i As Integer
strEmailAddr = p_strSmtp.Replace("smtp.", p_strUserName & "@")
Try
conf.Fields(CdoConfiguration.cdoSendUsingMethod).Value = CdoSendUsing.cdoSendUsingPort
conf.Fields(CdoConfiguration.cdoSMTPServer).Value = p_strSmtp
conf.Fields(CdoConfiguration.cdoSMTPServerPort).Value = p_nSmtpPort
conf.Fields(CdoConfiguration.cdoSMTPAccountName).Value = p_strUserName
conf.Fields(CdoConfiguration.cdoSendUserReplyEmailAddress).Value = """" + p_strUserName + """<" + strEmailAddr + ">" + ""
conf.Fields(CdoConfiguration.cdoSendEmailAddress).Value = """" + p_strUserName + """<" + strEmailAddr + ">" + ""
conf.Fields(CdoConfiguration.cdoSMTPAuthenticate).Value = CdoProtocolsAuthentication.cdoBasic
conf.Fields(CdoConfiguration.cdoSendUserName).Value = p_strUserName
conf.Fields(CdoConfiguration.cdoSendPassword).Value = p_strPSW
conf.Fields.Update() Dim msg As New MessageClass()
msg.Configuration = conf
msg.To = p_strReceiver
If Len(p_strCC) >= 0 Then
msg.CC = p_strCC
End If
msg.Subject = p_strSubject
msg.From = strEmailAddr
For i = 1 To array_strAttachment.Length
msg.AddAttachment(array_strAttachment(i - 1))
Next
If p_bHtml Then
msg.HTMLBody = p_strBody
Else
msg.TextBody = p_strBody
End If
msg.Send()
strReturn = p_strReceiver & "发送成功" & Now
Catch er As System.Runtime.InteropServices.COMException
strReturn = p_strReceiver & "发送失败" & Now
End Try
Return strReturn
End Function
我想我的代码没问题吧
To: slinfo():
具体怎么设置?我在2000SERVER里没动什么也可以发送的啊