| View previous topic :: View next topic |
| Author |
Message |
BoBo³ Guest
|
Posted: Sat Feb 14, 2009 11:26 pm Post subject: COM/WSH/Power Shell + AHK: Send Mail with Outlook |
|
|
What I didn't found at any thread here at the forum:
That article seems to give the answer. Well, to get that up and running - using AHK - would be a live saver (but keep in mind that the issues which are described at the bottom of the articles page needs to be solved too (hopefully)).
Any help is appreciated. Don't hesitate to enlighten us. Thx.  |
|
| Back to top |
|
 |
BoBo³ Guest
|
Posted: Sat Feb 14, 2009 11:30 pm Post subject: |
|
|
| Quote: | | would be a live saver | ok, ok, a life saver... !  |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sun Feb 15, 2009 4:24 pm Post subject: |
|
|
BoBo
I am not sure if this actually helps you because the prompts are still there
the latest version of COM are required and yes it has been updated recently
| Code: | COM_CoInitialize()
oMail:=COM_CreateObject("Outlook.Application")
newMail:=COM_Invoke(oMail,"CreateItem",0)
COM_Invoke(newMail,"Recipients.Add","xyz@xyz.com")
COM_Invoke(newMail,"Subject","test")
COM_Invoke(newMail,"Body","test Mail")
COM_Invoke(newMail,"Send")
COM_CoUninitialize() |
_________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sun Feb 15, 2009 4:48 pm Post subject: |
|
|
with attatchments
I wont help with the security prompts tho
| Code: | COM_CoInitialize()
oMail:=COM_CreateObject("Outlook.Application")
newMail:=COM_Invoke(oMail,"CreateItem",0)
COM_Invoke(newMail,"Recipients.Add","xyz@xyz.com")
COM_Invoke(newMail,"Subject","test")
COM_Invoke(newMail,"Body","test Mail")
COM_Invoke(newMail,"Attachments.add", "Path\Filename")
COM_Invoke(newMail,"Send")
COM_CoUninitialize() |
_________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
BoBo³ Guest
|
Posted: Sun Feb 15, 2009 6:04 pm Post subject: |
|
|
Sounds great! Thx tank!
will check it out tomorrow (at the office).
Btw, any idea how multiple recipients have to be specified? My assumption: | Code: | | COM_Invoke(newMail,"Recipients.Add","xyz@xyz.com;abc@xyz.com;123@xyz.com") | Feel free to confirm.  |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sun Feb 15, 2009 6:11 pm Post subject: |
|
|
Edit the above doesnt work use this method instead
| Code: | COM_Invoke(newMail,"Recipients.Add","xyz1@xyz.com")
COM_Invoke(newMail,"Recipients.Add","xyz2@xyz.com")
COM_Invoke(newMail,"Recipients.Add","xyz3@xyz.com") |
_________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
BoBo³ Guest
|
Posted: Mon Feb 16, 2009 11:59 am Post subject: |
|
|
Great!! Works like a charm.
So let's come back to the annoying factor: Outlook security! - which of course makes sense - but not if me, myself and I wants to send a mail to myself! OK. But that seems to make it: [When the Outlook security warning is fired]
If you tank, or anyone out there is able to implement the given/linked workarround into a script (or whatever method), I'll rename my favourite AHK-Hotkey after you (or my next son/daughter)!
If you hesitate to provide such kind of "bypassing" features in the forum, don't hesitate to send me (BoBo²) a PM.
Thx 4 Ur time  |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
|
| Back to top |
|
 |
BoBo³ Guest
|
Posted: Mon Feb 16, 2009 4:59 pm Post subject: |
|
|
I've to use my existing/personalized internal (company) mail account to sent whatever (notification) mails to internal recipients (AND, best case, an external account if I'm on "24/7-OnCall"). SMTP configuration (and other things were I would have to fight with an MS-Exchange administrator) have a 99,98% chance to be denied ad-hoc.
I'd be happy to use Sean's option, if I would be able to collect the neccessary "mandatory settings"-info eg. from my outlook client on my own ...  |
|
| Back to top |
|
 |
BoBo³ Guest
|
Posted: Mon Feb 16, 2009 5:59 pm Post subject: |
|
|
GOSH! Thx, tank (and of course Sean!) IT WORKED!
* dancing BoBos (looking for the bottle of Aberlour a'bunadh to celebrate that scripting event) * |
|
| Back to top |
|
 |
The Unknown Jobber
Joined: 19 Nov 2009 Posts: 161 Location: Florida
|
Posted: Thu Feb 04, 2010 8:49 pm Post subject: |
|
|
| BoBo³ wrote: | GOSH! Thx, tank (and of course Sean!) IT WORKED!
* dancing BoBos (looking for the bottle of Aberlour a'bunadh to celebrate that scripting event) * |
is it an exchange server? |
|
| Back to top |
|
 |
OceanMachine
Joined: 15 Oct 2007 Posts: 780 Location: England
|
Posted: Thu Feb 04, 2010 9:01 pm Post subject: |
|
|
| frescalus wrote: | | BoBo³ wrote: | GOSH! Thx, tank (and of course Sean!) IT WORKED!
* dancing BoBos (looking for the bottle of Aberlour a'bunadh to celebrate that scripting event) * |
is it an exchange server? |
How did you resolve this BoBo? security workaround, or using Sean's email or some other way?
I know this is an old thread, but the above bump brought it to the top of the stack, and I was interested  |
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Thu Feb 04, 2010 9:40 pm Post subject: |
|
|
This sort of method may be easier on you if you just want to address mails, you'll of course have to adjust it to your own needs...
| Code: | EmailRunString := "mailto:" . contactemail . "?subject=" . SubjectString . "&body=" . verbagestring . `%0A`%0A . casedetailsstring . contactstring
Run, %EmailRunString%
|
|
|
| Back to top |
|
 |
OceanMachine
Joined: 15 Oct 2007 Posts: 780 Location: England
|
Posted: Thu Feb 04, 2010 10:03 pm Post subject: |
|
|
Hmm running mailto: - I didn't know about that, very interesting
However, this won't actually send the mail, it will just compose the mail (in the default email program) and wait for me to press the send button, won't it?
I wondered whether he had managed to get a script to send a mail using Outlook, but had somehow bypassed Outlook's security nag ("a program on your computer is trying to send mail, do you want to allow it?" or something like that...)
Last edited by OceanMachine on Thu Feb 04, 2010 10:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Thu Feb 04, 2010 10:06 pm Post subject: |
|
|
There are ways with COM in excel to bypass the nags, but I don't know if it will work for Outlook:
| Code: | COM_Invoke(pxl, "DisplayAlerts", "False")
|
(especially since it's a security feature tied to the removal of active content in the Outlook reading pane like 3-5 years ago sometime, they went berserk on this security hole because it was causing like fully 90% of virus infections so it might be permanently turned on) |
|
| Back to top |
|
 |
|