celestialspring Posted September 3, 2009 Share Posted September 3, 2009 Hi Guys, Please see the code below and advice what am I doing wrong: I want to use a variable in the command. $ourfile = "c:\pdf\" & "$newname" ShellExecute("mailto:test@test.com?subject=" & $ourfile & "&body= Please see attachment&attachment=""" & $ourfile & """","","","",0) Thanks. Cs Link to comment Share on other sites More sharing options...
99ojo Posted September 3, 2009 Share Posted September 3, 2009 Hi Guys, Please see the code below and advice what am I doing wrong: I want to use a variable in the command. $ourfile = "c:\pdf\" & "$newname" ShellExecute("mailto:test@test.com?subject=" & $ourfile & "&body= Please see attachment&attachment=""" & $ourfile & """","","","",0) Thanks. Cs Hi, I'm not quite sure. It seems that you want to send with Outlook express. There's a limitation, that you can't attach files with mailto with OE. You may google. ;-(( Stefan Link to comment Share on other sites More sharing options...
celestialspring Posted September 3, 2009 Author Share Posted September 3, 2009 Hi,I'm not quite sure. It seems that you want to send with Outlook express. There's a limitation, that you can't attach files with mailto with OE.You may google.;-((StefanNo, mate. I am using Outlook (2007). Link to comment Share on other sites More sharing options...
Jfish Posted September 3, 2009 Share Posted September 3, 2009 I am not sure what error you are getting. However, I once had issues with Outlook sending messages because of the security settings. It does not like when a foreign program attempts to send an email because it looks like a virus. I used the Redemption DLL (search the net for this - its free) to tell Outlook that the message was safe. This worked. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
celestialspring Posted September 3, 2009 Author Share Posted September 3, 2009 No, the error is that its not attaching the attachment with the new message. Link to comment Share on other sites More sharing options...
99ojo Posted September 3, 2009 Share Posted September 3, 2009 (edited) No, the error is that its not attaching the attachment with the new message. Hi, try this: CreateMailItem() Func CreateMailItem() Local $olMailItem = 0 Local $olFormatRichText = 3 Local $olImportanceLow = 0 Local $olImportanceNormal= 1 Local $olImportanceHigh = 2 $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) With $oOMail .To = ("to@domain.com") .Subject = "email subject" .BodyFormat = $olFormatRichText .Importance = $olImportanceHigh .Body = "email message" .Attach = "myfile" .Display ;.Send EndWith EndFunc You may have to change $oOApp = ObjCreate("Outlook.Application") to $oOApp = ObjCreate("Outlook.Application.12") ;-)) Stefan Edited September 3, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Rishav Posted September 3, 2009 Share Posted September 3, 2009 over my head mostly, but if you want to send off a mail using smtp, then check this post. it handles attachments. maybe it will give you some ideas. http://www.autoitscript.com/forum/index.php?showtopic=23860 btw, Hi Stefan. Link to comment Share on other sites More sharing options...
99ojo Posted September 3, 2009 Share Posted September 3, 2009 Hi, this is running with Outlook 2003. You may have to change $oOApp = ObjCreate("Outlook.Application") to $oOApp = ObjCreate("Outlook.Application.12") Global $file = "c:\j.txt" CreateMailItem() Func CreateMailItem() Const $olByValue = 1 Local $olMailItem = 0 Local $olFormatRichText = 3 Local $olImportanceLow = 0 Local $olImportanceNormal= 1 Local $olImportanceHigh = 2 $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) With $oOMail .To = ("to@domain.com") .Subject = "email subject" .BodyFormat = $olFormatRichText .Importance = $olImportanceHigh .Body = "email message" .Attachments.Add ($file, $olByValue , 1) .Display ;.Send ; doesn't work for security reason EndWith EndFunc ;-)) Stefan Link to comment Share on other sites More sharing options...
celestialspring Posted September 4, 2009 Author Share Posted September 4, 2009 Hi, this is running with Outlook 2003. You may have to change $oOApp = ObjCreate("Outlook.Application") to $oOApp = ObjCreate("Outlook.Application.12") Global $file = "c:\j.txt" CreateMailItem() Func CreateMailItem() Const $olByValue = 1 Local $olMailItem = 0 Local $olFormatRichText = 3 Local $olImportanceLow = 0 Local $olImportanceNormal= 1 Local $olImportanceHigh = 2 $oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) With $oOMail .To = ("to@domain.com") .Subject = "email subject" .BodyFormat = $olFormatRichText .Importance = $olImportanceHigh .Body = "email message" .Attachments.Add ($file, $olByValue , 1) .Display ;.Send ; doesn't work for security reason EndWith EndFunc ;-)) Stefan Works great. Thank you. Link to comment Share on other sites More sharing options...
celestialspring Posted September 5, 2009 Author Share Posted September 5, 2009 This one is much easier, if you just want to have an attachment. $ourfile = "c:\try.txt" ShellExecute("D:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE", "/a " & $ourfile) Skeletor 1 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