Page 1 of 2 12>
Topic Options
#84757 - 2001-12-31 03:51 PM Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
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 ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#84758 - 2001-12-31 04:12 PM Re: Tester needed - Outlook and Outlook Express Automation
Anonymous
Unregistered


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 ]

Top
#84759 - 2001-12-31 04:16 PM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Sorry, i've corrected my mistake. Forgot to rename a variable
can you retest it ?
_________________________
? getobject(Kixtart.org.Signature)

Top
#84760 - 2001-12-31 04:17 PM Re: Tester needed - Outlook and Outlook Express Automation
Anonymous
Unregistered


Maybe it's handy to know that I haven't Outlook installed only Outlook Express.
Top
#84761 - 2001-12-31 04:18 PM Re: Tester needed - Outlook and Outlook Express Automation
Anonymous
Unregistered


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

Top
#84762 - 2001-12-31 04:27 PM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
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 ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#84763 - 2001-12-31 04:35 PM Re: Tester needed - Outlook and Outlook Express Automation
Anonymous
Unregistered


It returns: Invalid class string
Top
#84764 - 2001-12-31 04:36 PM Re: Tester needed - Outlook and Outlook Express Automation
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
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...

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#84765 - 2001-12-31 04:39 PM Re: Tester needed - Outlook and Outlook Express Automation
Anonymous
Unregistered


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

Top
#84766 - 2001-12-31 04:42 PM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
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 ]

_________________________
? getobject(Kixtart.org.Signature)

Top
#84767 - 2002-01-03 12:51 AM Re: Tester needed - Outlook and Outlook Express Automation
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Alex,
are you working on a new outlook virus?
it's just looking like it...
_________________________
!

download KiXnet

Top
#84768 - 2002-01-02 01:56 PM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Lol
Just a way to send a mail only with usual mail utilities.
_________________________
? getobject(Kixtart.org.Signature)

Top
#84769 - 2002-01-02 03:58 PM Re: Tester needed - Outlook and Outlook Express Automation
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
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

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#84770 - 2002-01-02 11:24 PM Re: Tester needed - Outlook and Outlook Express Automation
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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 ]
Top
#84771 - 2002-01-03 01:49 AM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France

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 ?

_________________________
? getobject(Kixtart.org.Signature)

Top
#84772 - 2002-01-03 01:58 AM Re: Tester needed - Outlook and Outlook Express Automation
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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.

Top
#84773 - 2002-01-03 02:07 AM Re: Tester needed - Outlook and Outlook Express Automation
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
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

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#84774 - 2002-01-04 06:28 AM Re: Tester needed - Outlook and Outlook Express Automation
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
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...

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#84775 - 2002-01-06 10:33 AM Re: Tester needed - Outlook and Outlook Express Automation
attiahia Offline
Hey THIS is FUN

Registered: 2000-03-27
Posts: 268
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 ]

Top
#84776 - 2002-01-06 03:39 PM Re: Tester needed - Outlook and Outlook Express Automation
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
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).

_________________________
? getobject(Kixtart.org.Signature)

Top
Page 1 of 2 12>


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.071 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org