html - 在 VB 6.0 中将 HTML 文件附加为电子邮件

标签 html email file vb6 attachment

我正在尝试使用 Visual Basic 6.0 将 html 文件附加到电子邮件。当光标出现在 Open strFile For Binary Access Read As #hFile 行时,它给出错误“Error encoding file - Bad file name or number”。非常感谢您的所有帮助和支持。

Dim handleFile               As Integer
Dim strValue              As String
Dim lEventCtr           As Long
handleFile = FreeFile
Open strFile For Binary Access Read As #handleFile
Do While Not EOF(hFile)
    ' read & Base 64 encode a line of characters
    strValue = Input(57, #handleFile)
    SendCommand EncodeBase64String(strValue) & vbCrLf

    ' DoEvents (occasionally)
    lEventCtr = lEventCtr + 1
    If lEventCtr Mod 50 = 0 Then DoEvents
Loop
Close #handleFile
Exit Sub
File_Error:
Close #handleFile
m_ErrorDesc = "Error encoding file - " & Err.Description
Err.Raise Err.Number, Err.Source, m_ErrorDesc
End Sub

最佳答案

这就是为什么您应该始终使用 OPTION EXPLICIT 的原因。您应该检查 EOF(handleFile) 而不是 EOF(hFile)

关于html - 在 VB 6.0 中将 HTML 文件附加为电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2101199/

相关文章:

javascript - 如何将数组中的所有值四舍五入到小数点后两位

ios - 使用 mailcore (iOS),我怎样才能从特定的电子邮件地址获取所有电子邮件?

forms - 发送电子邮件字段未在营销人员的 Sitecore Web 表单中呈现

javascript - 当用户再次单击下拉列表时,如何隐藏当前选定的 li 元素成为一个选项?

javascript - 寻求帮助将 .toFixed 添加到 jquery。

javascript - 电子邮件不会发送 Angular 4 和 PHP

file - 如何将文件从SSH远程主机复制到Jenkins服务器

azure - Azure VM 上的共享文件夹

c - 在文件中搜索特定行的 c 代码

html - CSS 将菜单对齐到 div 的右侧