0

我必须在成功提交表格后向申请人发送一封简单的邮件。vb 中的代码是什么?我一直在尝试这个..

function email()
    Set mailObj=CreateObject("CDO.Message")
        mailObj.Subject="Hello"
        mailObj.From="abc@xyz.com"
        mailObj.To="123@456.com"
        mailObj.TextBody="text"
        mailObj.Send
    set mailObj=nothing
end function

代码有问题吗?请纠正..

4

1 回答 1

3

使用类似下面的东西。

 Set objEmail = CreateObject("CDO.Message") 
 objEmail.From = "fromsomeone@company.com"
 objEmail.To = "someone@company.com"

 objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
 objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
     "your.smtpserver.here"
 objEmail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
 objEmail.Configuration.Fields.Update

 objEmail.TextBody = "The body of the email"
 objEmail.Subject = "The subject"

 objEmail.Send
于 2012-10-16T08:22:33.117 回答