Alex.H
(Seasoned Scripter)
2001-12-31 03:51 PM
Tester needed - Outlook and Outlook Express Automation

Since i don't have Outlook Express installed (to be honest, I'm allergic to O and OE), can someone test this script with it ? (don't forget to change the destination address)
code:

$Root = CreateObject("Outlook.Application")
$MailItem = $Root.CreateItem(0) ; olMailItem object
$MailItem.Importance=2
$MailItem.Subject = "Automation Test"
$MailItem.To = "Please edit me@I_really_want_it" ; Multiple element can be separated with ;
$MailItem.Body = "this is a test sample of a future SendMail UDF()"
$MailItem.Send

TIA

[ 31 December 2001: Message edited by: Alex.H ]

**DONOTDELETE**
(Lurker)
2001-12-31 04:12 PM
Re: Tester needed - Outlook and Outlook Express Automation

I had tested it with OE5.5 SP2.
I got the following error:
Script error : unknown command !
$MailItem.Importance=2

UPDATE: By every command who starts with $Mailitem. I get this error.

[ 31 December 2001: Message edited by: awinkel ]

Alex.H
(Seasoned Scripter)
2001-12-31 04:16 PM
Re: Tester needed - Outlook and Outlook Express Automation

Sorry, i've corrected my mistake. Forgot to rename a variable
can you retest it ?


**DONOTDELETE**
(Lurker)
2001-12-31 04:17 PM
Re: Tester needed - Outlook and Outlook Express Automation

Maybe it's handy to know that I haven't Outlook installed only Outlook Express.

**DONOTDELETE**
(Lurker)
2001-12-31 04:18 PM
Re: Tester needed - Outlook and Outlook Express Automation

I get the following error yet.
Script error : unknown command !
$MailItem = $Root.CreateItem(0) ; olMailItem object


Alex.H
(Seasoned Scripter)
2001-12-31 04:27 PM
Re: Tester needed - Outlook and Outlook Express Automation

I've got my answer, thanks
In fact, I was wondering if Outlook Express had the same automation object than Outlook, and the result you got show that it's not the case. Damn M$

Add this to be sure just after the createobject:
? "" + @serror

[ 31 December 2001: Message edited by: Alex.H ]

**DONOTDELETE**
(Lurker)
2001-12-31 04:35 PM
Re: Tester needed - Outlook and Outlook Express Automation

It returns: Invalid class string

Radimus
(KiX Supporter)
2001-12-31 04:36 PM
Re: Tester needed - Outlook and Outlook Express Automation

I'm running this on winXP and office XP

It prompted me with the "A program is trying to automaticall send e-mail on your behalf. Do you want to allow this? "
Yes/No/Help

It will sort of work...

**DONOTDELETE**
(Lurker)
2001-12-31 04:39 PM
Re: Tester needed - Outlook and Outlook Express Automation

So it's clear that it will work with Outlook but doesn't work with Outlook Express.
Maybe a new project?


Alex.H
(Seasoned Scripter)
2001-12-31 04:42 PM
Re: Tester needed - Outlook and Outlook Express Automation

Outlook is installed with Ms Office.
Outlook Express is his little brother, completely free(!) and without some (most of ?) features
On the other hand, i didn't know that Ms add this messagebox. Well, a sendkeys("Enter") will be enough.

Thanks guys

[ 31 December 2001: Message edited by: Alex.H ]

LonkeroAdministrator
(KiX Master Guru)
2002-01-03 12:51 AM
Re: Tester needed - Outlook and Outlook Express Automation

Alex,
are you working on a new outlook virus?
it's just looking like it...


Alex.H
(Seasoned Scripter)
2002-01-02 01:56 PM
Re: Tester needed - Outlook and Outlook Express Automation

Lol
Just a way to send a mail only with usual mail utilities.


Kdyer
(KiX Supporter)
2002-01-02 03:58 PM
Re: Tester needed - Outlook and Outlook Express Automation

Alex,

Does this work for you?

code:

BREAK ON CLS
; -- Ref - http://cwashington.netreach.net/depo/view.asp?Index=192&ScriptType=vbscript
;Set theApp = WScript.CreateObject("Outlook.Application")
$Root = CreateObject("Outlook.Application")
$theNameSpace = $Root.GetNameSpace("MAPI")
$theNameSpace.Logon "profile", "password"
$theMailItem = $Root.CreateItem(0)

$theMailItem.Recipients.Add "dyerkb@myrealbox.com"
$theMailItem.Subject = "Your Subject Here"
$theMailItem.Body = "Your message here."
$theMailItem.Send
$theNameSpace.Logoff

HTH,

- Kent

NTDOCAdministrator
(KiX Master)
2002-01-02 11:24 PM
Re: Tester needed - Outlook and Outlook Express Automation

FYI<BR>I'm running Windows 2000 SP2 with Outlook 2000 SR1<P>Kent,<P>I could not get your code to work at all. It says it does not understand this line:<P>$theNameSpace.Logon "profile", "password"<P>even if I supply valid info in its place.<P><BR>Alex H<BR>I get the following error using your code.<BR><BLOCKQUOTE><font size="1" face="helvetica, arial, sans-serif">code:</font><HR><pre>$Root = CreateObject("Outlook.Application")<BR>$MailItem = $Root.CreateItem(0) ; olMailItem object<BR>? @ERROR<BR>? @serror<BR>$MailItem.Importance=2<BR>$MailItem.Subject = "Automation Test"<BR>$MailItem.To = "man@hotmail.com"<BR>$MailItem.Body = "this is a test 2 sample of a future SendMail UDF()"<BR>$MailItem.Send<BR>? "Next error log..."<BR>? @ERROR<BR>? @serror<BR></pre><HR></BLOCKQUOTE><BR><B>kix32.exe mailit2.kix<BR>0<BR>The operation completed successfully.<BR>Next error log...<BR>1<BR>COM exception error "Send" (Microsoft Outlook - Outlook does not recognize one or more names. ) [1/1]</B><P>It looks like it has some kind of problem with the SEND command maybe.<p>[ 02 January 2002: Message edited by: NTDOC ]

Alex.H
(Seasoned Scripter)
2002-01-03 01:49 AM
Re: Tester needed - Outlook and Outlook Express Automation


Duh!
NTDOC,
You need some rest (me too). Please, correct this by adding a second @ in the address.

kdyer,
Please do the same and retest.

Radimus and awinkel,
did you think to correct it when you tested the script ?

NTDOCAdministrator
(KiX Master)
2002-01-03 01:58 AM
Re: Tester needed - Outlook and Outlook Express Automation

Okay Alex... Your right, I was not even really looking at the code. I took it at face value and ran it.

adding the @ to the address so that it is @@ works fine on my system.

Kdyer
(KiX Supporter)
2002-01-03 02:07 AM
Re: Tester needed - Outlook and Outlook Express Automation

Alex,

Works great!

Couple of suggestions..

After the send piece, I added:
$Root.Quit
$Root = ""

To cleanly close out of Outlook.

Have a look at - http://www.mvps.org/word/FAQs/InterDev/SendMail.htm and there is a "test function" to see if Outlook is open and if not, it closes it otherwise, it remains open.

Thanks!

- Kent

Radimus
(KiX Supporter)
2002-01-04 06:28 AM
Re: Tester needed - Outlook and Outlook Express Automation

it works, but the Outlook security still blocks it... oh well you can't have everything.

MS will be pissed if you guys figure out how to send Anthrax through Outlook... as that is the only virus to not be propigated using MS software...

attiahia
(Hey THIS is FUN)
2002-01-06 10:33 AM
Re: Tester needed - Outlook and Outlook Express Automation

It works excellent.
. Is there a way to send attachment with the e-mail?
Is there a way to place active shortcut in the e-mail body.
Thank you.

[ 06 January 2002: Message edited by: attiahia ]

Alex.H
(Seasoned Scripter)
2002-01-06 03:39 PM
Re: Tester needed - Outlook and Outlook Express Automation

I didn't really get a look to this part, only the possbility to send a mail when all is getting wrong, something like :
Hey sucker, your f$^ù script don't work at all unless the sendmail for this user : ... Now go and correct this and don't ever mind to sleep this night.

But you should get a look to the link kdyer provide, the attachment part is at the end (in VB, but easy to transcribe).

Kdyer
(KiX Supporter)
2002-01-07 02:55 AM
Re: Tester needed - Outlook and Outlook Express Automation

attiahia,

Make the following modifications to the script, and you should be good to go!

code:

$MailItem.Attachments.Add("C:\TEST\TEST.LNK")
$MailItem.Send

HTH,

- Kent

attiahia
(Hey THIS is FUN)
2002-01-07 06:54 AM
Re: Tester needed - Outlook and Outlook Express Automation

Alex, Kdyer Thank you a lot .

Can I place shortcut or URL in the e-mail?

Thanks

Kdyer
(KiX Supporter)
2002-01-07 07:58 AM
Re: Tester needed - Outlook and Outlook Express Automation

I believe it depends on the SP of Outlook. For example, Outlook 2000 up to SP-2 allows "dangerous" extensions to be sent through (like EXE). I believe there are patch work-arounds for this too, however Outlook XP has settings to turn these features on or off.

HTH,

- Kent

Radimus
(KiX Supporter)
2002-01-07 11:34 PM
Re: Tester needed - Outlook and Outlook Express Automation

I've UDF'ed this, since it works in my work environment...

code:

;*************************************************************************************************************************
;example Email("Wheelerc","Test of email","This will send an email to a valid ahca email address")

Function email($Recipient, $Subject, optional $Body, optional $Attachment)
$Root = CreateObject("Outlook.Application")
$MailItem = $Root.CreateItem(0)
$MailItem.Importance = 2
$MailItem.Subject = "Automation Test"
$MailItem.To = "$Recipient@@fdhc.state.fl.us"
if $Body $MailItem.Body = $Body endif
if $Attachment $MailItem.Attachments.Add("$Attachment") endif
$MailItem.Send
$Root = ""
EndFunction



attiahia
(Hey THIS is FUN)
2002-02-04 01:03 PM
Re: Tester needed - Outlook and Outlook Express Automation

I want to send an exe shortcut (\\Server_name\Shared_Name\Program.exe) as body of the e-mail.

I tried: $MailItem.HTMLBody = "\\Server_name\Shared_Name\Program.exe"

But did not work.

Please Help

Thank you.

[ 04 February 2002: Message edited by: attiahia ]

Alex.H
(Seasoned Scripter)
2002-02-04 01:50 PM
Re: Tester needed - Outlook and Outlook Express Automation

attiahia,
try this one instead :
$MailItem.HTMLBody = "\\Server_name\Shared_Name\Program.exe.lnk"

Also, did you manage to get something with AD ? I completely lost (and forgot, i have to say) the thread about it.

attiahia
(Hey THIS is FUN)
2002-02-05 08:30 AM
Re: Tester needed - Outlook and Outlook Express Automation

I am really receiving great support from you and some time I feel that I owe you.

$MailItem.HTMLBody = "\\Server_name\Shared_Name\Program.exe.lnk"
Did Not work, I received the e-mail but the shortcut was not active, it was just TXT.

According AD & LDA your first function worked excellent and it save me a lot.

But when I tried to use it to handle our internet user, it did not work.

I know that some time (maybe all time) my questions become boring, therefore I do not like to repeat my LDAP question/problem here again. Please extend your usual help and refer to it in the scripts forum http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=002711

I am waiting your or shawn help to answer my last question (in above link) which I posted on 21 January 2002

Thank you.

[ 05 February 2002: Message edited by: attiahia ]

[ 05 February 2002: Message edited by: attiahia ]

[ 05 February 2002: Message edited by: attiahia ]