在使用crystal report 8.5的visual basic 6.0中,如何直接邮寄报告?

时间:2014-04-23 19:07:11

标签: vb6 crystal-reports

我使用的是visual basic 6.0和crystal report 8.0

如何将直接生成的报告邮寄到任何邮件ID?

1 个答案:

答案 0 :(得分:0)

这适用于SMTP。请参阅使用Exchange的文档。

Set emailObj      = CreateObject("CDO.Message")
emailObj.From     = "fred@gmail.com"

emailObj.To       = "fred@gmail.com"

emailObj.Subject  = "Test CDO"
emailObj.TextBody = "Test CDO"

emailObj.AddAttachment "c:\windows\win.ini"

Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")    = 2  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")      = true 
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")    = "fred"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")    = "pass"
emailConfig.Fields.Update

emailObj.Send

If err.number = 0 then Msgbox "Done"