您的位置首页百科词库

vb发送邮件

vb发送邮件

Public Function Fsyj(StrFsyx As String, StrFsmm As String, StrFsbt As String, StrFsnr As String, StrFsfw As String, StrJsyx As String) As BooleanstrName = "http://schemas.microsoft.com/cdo/configuration/"Set objEmail = CreateObject("CDO.Message") Fsyj = False objEmail.From = StrFsyx '发送邮件搭空帆地址 objEmail.To = StrJsyx '接受邮件地址 objEmail.Subject = StrFsbt '邮件标题 objEmail.Textbody = StrFsnr '邮件内容 objEmail.Configuration.Fields.Item(strName & "sendusing") = 2 objEmail.Configuration.Fields.Item(strName & "smtpserver") = StrFsfw 'smtp.163.com发送邮箱的服务器 objEmail.Configuration.Fields.Item(strName & "smtpserverport") = 25 objEmail.Configuration.Fields.Item(strName & "smtpauthenticate") = 1 objEmail.Configuration.Fields.Item(strName & "sendusername"亏唤) = Left(StrFsyx, InStr(StrFsyx, "@") - 1) objEmail.Configuration.Fields.Item(strName & "sendpassword") = StrFsmm '发送邮件知雹邮箱密码 objEmail.Configuration.Fields.Update objEmail.Send Fsyj = TrueEnd FunctionPrivate Sub Cmd1_Click()k = Fsyj("**@163.com", "********", txt1, txt2, "smtp.163.com", "**@qq.com")End Sub请参阅我的博客:http://hi.baidu.com/zgmg/blog/item/77ffee1780f5b702c83d6d35.html