Jump to content

Need sonme Help Sending Mail with Outlook.


Altrez
 Share

Recommended Posts

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

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=89321

Go, 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

  • 1 month later...

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=89321

Go, 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...