我想使用outlook 2010發送電子郵件,windows 7 & IE8,獲取「Outlook.Application」對象所需的代碼是什麼?通過vbscript打開outlook 2010
我試着用 的CreateObject( 「Outlook.Application」),但得到錯誤 「必選對象」
我想使用outlook 2010發送電子郵件,windows 7 & IE8,獲取「Outlook.Application」對象所需的代碼是什麼?通過vbscript打開outlook 2010
我試着用 的CreateObject( 「Outlook.Application」),但得到錯誤 「必選對象」
示例代碼: -
' Create email object
Set oolApp = CreateObject("Outlook.Application")
Set email = oolApp.CreateItem(0)
email.Recipients.Add("[email protected]")
' Create the body of the email
MailBody = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD W3 HTML//EN"">"
MailBody = MailBody & "<HTML>" & vbcrlf
MailBody = MailBody & "<HEAD><TITLE>No Invoices</TITLE></HEAD>"
MailBody = MailBody & "<BODY>" & vbcrlf
MailBody = MailBody & "<B>For Your Information</B>,<BR><BR>"
MailBody = MailBody & "This is Sample Email.<BR><BR>"
MailBody = MailBody & "</BODY></HTML>"
' Send the Email
email.Subject = "No Invoices Issued"
email.HTMLBody = MailBody
email.Send
可以使用CDO是子系統發送一封電子郵件, Outlook使用。您可以在ASP Free上的文章Sending Emails Using CDO in WSH中找到更多信息。
Set objMessage = CreateObject("CDO.Message")
' Set Email Headers
objMessage.From = "[email protected]"
objMessage.To = "[email protected]"
objMessage.Subject = "No Invoices Issued"
' Construct Email Body
objMessage.HTMLbody = "<b>For Your Information</b>, <br><br>" _
& "This is a Sample Email.<br><br>"
objMessage.AutoGenerateTextBody = True
' Set Server Settings
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mymail.com"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
試試這個簡單的代碼。
這將幫助你,直到打開Outlook和瀏覽你收件箱
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Default Outlook Profile", , False, True
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
objFolder.Display
End Sub
是的,你需要像 設置oolApp =的CreateObject(「Outlook.Application」) 設置電子郵件= oolApp創建對象。 CreateItem(0) – Amol 2012-02-22 09:47:19
CreateObject(「Outlook.Application」)正在返回錯誤號424(需要的對象) – Vikas 2012-02-22 10:04:16
你必須做什麼? 你想發送電子郵件或什麼? – Amol 2012-02-22 11:35:18