我用CDO发送邮件,但是后来发现发送一点都不稳定,最差的情况是发送10次只有5次是成功的。请问是什么原因呢。
或者是还有什么好的方法可以保证发送邮件可以保证稳定呢?(不要安装其他控件的情况下,即其他用户使用的时候不需要安装其他控件)以下是我的代码Dim objEmail As Object
Dim strName As StringPrivate Sub Command2_Click()
  Open "D:\问卷调查.txt" For Append As #1
  txtBody.Text = txtAn1 & "哈" & txtAn2 & "哈" & txtAn3 & "哈" & txtAn4 & "哈" & txtAn5 & "哈" & txtAn6 & "哈" & txtAn7 & "哈" & txtAn8 & "哈" & txtAn9
  Print #1, txtBody.Text
Print #1,
Close #1
MsgBox "问卷结果已经保存在您的D盘,文件名是“问卷调查.txt”"
End
End SubPrivate Sub Form_Load()
    strName = "http://schemas.microsoft.com/cdo/configuration/"
    Set objEmail = CreateObject("CDO.Message")
End SubPrivate Sub Command1_Click()
    Me.Caption = "Sending..."
    Command1.Enabled = False
    txtBody.Text = txtAn1 & "哈" & txtAn2 & "哈" & txtAn3 & "哈" & txtAn4 & "哈" & txtAn5 & "哈" & txtAn6 & "哈" & txtAn7 & "哈" & txtAn8 & "哈" & txtAn9
    objEmail.From = "[email protected]"
    objEmail.To = "[email protected]"
    objEmail.Subject = "收集问卷"
    objEmail.Textbody = txtBody.Text
    objEmail.Configuration.Fields.Item(strName & "sendusing") = 2
    objEmail.Configuration.Fields.Item(strName & "smtpserver") = "smtp.sohu.com"
    objEmail.Configuration.Fields.Item(strName & "smtpserverport") = 25
    objEmail.Configuration.Fields.Item(strName & "smtpauthenticate") = 1
    objEmail.Configuration.Fields.Item(strName & "sendusername") = Left("[email protected]", InStr("[email protected]", "@") - 1)
    objEmail.Configuration.Fields.Item(strName & "sendpassword") = "XXXXX"
    objEmail.Configuration.Fields.Update
    objEmail.Send
    Command1.Enabled = True
    Me.Caption = "Send OK!"
    MsgBox "再次感谢您的参与,再见!^_^"
    End
End Sub