终于用vb调用API实现了,在PB里应该也一样
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
//定义临时变量
//产生邮件会话对象mses
mses = create mailsession
//邮件登录。此处用户名,口令缺省
mreturn = mses.maillogon('','',mailNewSessionWithDownLoad!)
mses.mailGetMessages()
if mreturn <> mailreturnsuccess! Then
messagebox("邮件登录","邮件登录失败!")
return 0
end if
mreturn=mses.mailaddress(mmsg)
if mreturn<>mailreturnsuccess! then
messagebox("邮件地址","邮件地址出错!")
return
end if
mmsg.subject=sle_1.text
mmsg.notetext=mle_1.text
mattach.filetype=mailattach!
mattach.pathname=ORI_FILE
mattach.filename=ORI_FILE
mattach.position=len(mmsg.notetext) - 1
mmsg.attachmentfile[1]=mattach
mreturn=mses.mailsend(mmsg)
if mreturn<>mailreturnsuccess! then
messagebox("提示!","文件不能发送,请检查!")
return
else
messagebox("提示!","文件发送成功!")
end if
mses.maillogoff()
destroy mses