您的位置:首页 > 编程语言 > VB

VB.net 调用OutLook发邮件(程序自动添加附件)

2011-11-07 21:38 288 查看
Dim rkey As Microsoft.Win32.RegistryKey

Dim path As String

Dim subject As String

Dim EmailTo As String

Dim AttachPath As String

rkey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(“mailto/shell/open/command”) ‘取得Outlook程序位置

If rkey IsNot Nothing Then

path = rkey.GetValue(“”).ToString() & ” “

path = path.Substring(0, path.IndexOf(” “))

path = path.Replace(“”"”, “”)

rkey.Close()

Try

subject = “hello”

EmailTo = “myfriend@hotmail.com

AttachPath = “c:/sss.txt”

System.Diagnostics.Process.Start(path, “-c IPM.Note /m ” & EmailTo.Trim & “&subject=” & subject.Trim & ” ” & AttachPath.Trim)

Catch ex As Exception

End Try

End If
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: