vb.net读取邮件标题 vba获取邮件附件内容( 三 )

MESSAGES是信件集
MESSAGE是单封信件
ATTS是附件集
ATT是单个附件
————————————————————————
发信分割线
————————————————————————
拿个别人的回答改vb.net读取邮件标题了一下,俺VB几乎没用过,只会VB 。NET
先注册DLL
然后VB代码如下:
Private Sub Command1_Click()
SendMail "标题", "正文"
End Sub
Sub SendMail(Optional ByVal sSubject As String, _
Optional ByVal sBody As String)
Dim jmail
Set jmail = CreateObject("jmail.Message")
jmail.Charset = "gb2312"
jmail.Silent = False
jmail.Priority = 1 '邮件状态,1-5 1为最高
jmail.MailServerUserName = "XXX" 'Email帐号
jmail.MailServerPassWord = "XXX" 'Email密码
jmail.FromName = "XXX"'发信人姓名
jmail.From = "XXX@XXX.XXXX" '发邮件地址地址
jmail.Subject = sSubject'主题
jmail.AddRecipient "XXX@XXX.XXXX" '收信人地址
jmail.body = sBody '信件正文
jmail.Send ("smtp.163.com") 'SMTP服务器,如smtp.sohu.com
Set jmail = Nothing
End Sub
全vb.net读取邮件标题了 。FromName 和FROM 建议都用邮件地址,不然有的邮箱不收的
VB.NET如何获取任何格式文件的文字信息Option Explicit
'mTextUTF.bas
'模块:UTF文本文件访问
'作者:zyl910
'版本:1.0
'日期:2006-1-23

'== 说明 ===================================================
'支持Unicode编码的文本文件读写 。暂时支持ANSI、UTF-8、UTF-16LE、UTF-16BE这几种编码文本

'== 更新记录 ===============================================
'[V1.0] 2006-1-23
'1.支持最常见的ANSI、UTF-8、UTF-16LE、UTF-16BE这几种编码文本

'## 编译预处理常数 #########################################
'== 全局常数 ===============================================
'IncludeAPILib:引用了API库,此时不需要手动写API声明

'## API ####################################################
#If IncludeAPILib = 0 Then
'== File ===================================================
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Private Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long
Private Const INVALID_HANDLE_VALUE = https://www.04ip.com/post/-1
Private Const GENERIC_READ = H80000000
Private Const GENERIC_WRITE = H40000000
Private Const FILE_SHARE_READ = H1
Private Const FILE_SHARE_WRITE = H2
Private Const Create_NEW = 1
Private Const Create_ALWAYS = 2
Private Const OPEN_EXISTING = 3
Private Const OPEN_ALWAYS = 4
Private Const TRUNCATE_EXISTING = 5
Private Const FILE_ATTRIBUTE_NORMAL = H80
Private Const FILE_BEGIN = 0
Private Const FILE_CURRENT = 1
Private Const FILE_END = 2

'== Unicode ================================================

推荐阅读