Altrez Posted October 22, 2009 Share Posted October 22, 2009 Hello All, I am working on a script to send email and so far it is coming along really well. I have ran into an issue and can not seem to figure out how to fix the problem. What I would like to do is have the script open outlook and send a email with a attachment. Once the email is sent I would like outlook to close. Here's the script. $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) $oOMail.Save With $oOMail .To = ("example@test.com") .Subject = "test" .Body = "Hi this is a test" .attachments.add ("c:\test.txt") .Send I get the fallowing error: C:\Users\mail.au3 (2) : ==> Variable used without being declared.: $oOMail = $oOApp.CreateItem($olMailItem) $oOMail = $oOApp.CreateItem(^ ERROR I am not sure what I am doing wrong. Any help would be great! Thanks! Link to comment Share on other sites More sharing options...
enaiman Posted October 22, 2009 Share Posted October 22, 2009 Do you know - there is a very useful feature almost everywhere (here as well) called "Search"?If you have searched for "Outlook" in the "Example Scripts" forum the following link would have popped out instantly:http://www.autoitscript.com/forum/index.php?showtopic=89321Go, and sin no more. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Altrez Posted December 21, 2009 Author Share Posted December 21, 2009 Do you know - there is a very useful feature almost everywhere (here as well) called "Search"?If you have searched for "Outlook" in the "Example Scripts" forum the following link would have popped out instantly:http://www.autoitscript.com/forum/index.php?showtopic=89321Go, and sin no more. I thank you for the help. However the issue I am still having is the fact that the email will not send unless I have outlook opened? For example I can use the examples provided to open outlook and send the mail. However the mail remains in the outbox until someone re-opens outlook then the mail will send.I have not found a way to send the mail without having to reopen outlook? Any help would be great!!!Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now