Author Topic: Outlook  (Read 4314 times)

0 Members and 1 Guest are viewing this topic.

Tramber

  • Guest
Outlook
« on: August 08, 2006, 05:44:20 AM »
Would it be possible to create messages from Vlisp to Outlook ?

I'd like to program a utility that would be able to create a message with an object text and an attached file.

I've learnt to manage Excel from Lisp. Do you think I could learn to do so with Outlook ?

Do you know where I could find a few lines of code from wich I could be inspired ?

hendie

  • Guest
Re: Outlook
« Reply #1 on: August 08, 2006, 06:56:38 AM »
dunno about Vlisp. I don't see why not but you'll probably be jumping through hoops for a while.
why not use VBA, much simpler and pretty straightforward

http://www.vba-programmer.com/#OutlookBkmk

Tramber

  • Guest
Re: Outlook
« Reply #2 on: August 08, 2006, 07:26:27 AM »
I thank you but I'm alergic to VBA. But it must be translatable  :angel:

Patrick_35

  • Guest
Re: Outlook
« Reply #3 on: August 08, 2006, 07:27:08 AM »
Hi Call me Bert'
I find it
http://discussion.autodesk.com/thread.jspa?messageID=1142149

For launching outlook, I do this, but it still remains following finding it

Code: [Select]
(setq wsh (vlax-create-object "WScript.Shell"))
(setq app (vlax-invoke wsh 'exec "C:\\Program Files\\Outlook Express\\msimn.exe"))

And to close outlook
Code: [Select]
(vlax-invoke app 'terminate)
@+
« Last Edit: August 08, 2006, 07:40:24 AM by Patrick_35 »

Tramber

  • Guest
Re: Outlook
« Reply #4 on: August 08, 2006, 07:42:02 AM »
Tiens tiens !

Good job !
I'll have a look soon.

Patrick_35

  • Guest
Re: Outlook
« Reply #5 on: August 08, 2006, 09:38:37 AM »
I have advanced in my research
That should normally function but I could'nt test

Code: [Select]
(setq outlk (vlax-create-object "CDO.Message"))        ; Link for windows XP
(vlax-put-property outlk 'From "My_email@server.com")  ; Shipper
(vlax-put-property outlk 'To   "Recipient@server.com") ; Recipient
(vlax-put-property outlk 'Subject "Subject")           ; Subject
(vlax-put-property outlk 'TextBody "My Message")       ; Message
(vlax-invoke outlk 'Send)                              ; Send message
(vlax-release-object outlk)                            ; Release object

Other options

Code: [Select]
(vlax-put-property outlk 'AddAttachment "c:/rep1/rep2/My_Attach.txt") ; for link a piece
(vlax-put-property outlk 'HTMLBody "<br><img src='image.jpg'><br>")   : for link an image

More information with (vlax-dump-object outlk T)

@+

Tramber

  • Guest
Re: Outlook
« Reply #6 on: August 08, 2006, 10:40:35 AM »
I succeed with the prog I saw (and copied  :evil:) from discussion.autodesk but I can't make your piece of prog running.

This is what I get :

#<VLA-OBJECT IMessage 037b614c>
nil
nil
nil
nil
; erreur: CDO.Message.1: La valeur de configuration "SendUsing" est non valide.

First question, am  I supposed to get a nil at the vlax-put-property(s) ?

Tramber

  • Guest
Re: Outlook
« Reply #7 on: August 08, 2006, 10:59:03 AM »
There is also something terrific that I would love to do but it seems to be hard :

I got a signature in my Outlook configuration (with a text, an image, and so on....).
Would be a shame that I could not insert it, wouldn't it ?  :kewl:


Patrick_35

  • Guest
Re: Outlook
« Reply #8 on: August 08, 2006, 11:42:14 AM »
Quote
First question, am  I supposed to get a nil at the vlax-put-property(s) ?
No, after your (vlax-put-property(s) ...) you do an (vlax-dump-object #<VLA-OBJECT IMessage 037b614c>) and you see your modifications
My computer is not configured for outlook but for lotus and i have the same message. Outlook don't want to run. I suppose it's a problem of configuration and  a network Intranet

For the error, look
- http://www.faqoe.com/rep/cs.php3

For your signature, look
- http://www.paulsadowski.com/WSH/cdo.htm
- http://www.w3schools.com/asp/asp_send_email.asp

@+

ps : je bosse mon anglais  ^-^

Tramber

  • Guest
Re: Outlook
« Reply #9 on: August 08, 2006, 11:55:37 AM »
I've tried a :
Code: [Select]
(vlax-put-property mail_object 'CreateMHTMLBody "file://c:/test.htm")
or a
(vlax-invoke-method mail_object 'CreateMHTMLBody "file://c:/test.htm")

(I'm not a delicate person and try everything out, properties, methods they all do the same  :lmao: !)
But It didn't work, it says unknown AtiveX bla bla.

(quite a lot of fun today  8-))
« Last Edit: August 08, 2006, 11:56:42 AM by Call me Bert' »

Patrick_35

  • Guest
Re: Outlook
« Reply #10 on: August 08, 2006, 12:11:04 PM »
Quote
(vlax-invoke-method mail_object 'CreateMHTMLBody "file://c:/test.htm")
For me, it's the good solution
Have you created a virtual server ?

I find an another link http://www.atoutfox.org/articles.asp?ACTION=FCONSULTER&ID=0000000040

@+

Patrick_35

  • Guest
Re: Outlook
« Reply #11 on: August 08, 2006, 03:50:11 PM »
The solution :-)

Code: [Select]
(setq Outlk (vlax-Create-Object "CDO.Message"))

(setq Serv (vlax-Get-Property (vlax-Get-Property Outlk 'Configuration) 'Fields))
(vlax-Put-Property (vlax-Get-Property Serv 'Item "http://schemas.microsoft.com/cdo/configuration/sendusing")      'Value 2)
(vlax-Put-Property (vlax-Get-Property Serv 'Item "http://schemas.microsoft.com/cdo/configuration/smtpserver")     'Value "ServerSMTP") ; ex: smpt.aol.com
(vlax-Put-Property (vlax-Get-Property Serv 'Item "http://schemas.microsoft.com/cdo/configuration/smtpserverport") 'Value 25)
(vlax-Invoke Serv 'Update)

(vlax-Put-Property Outlk 'From     "My_email@server.com")
(vlax-Put-Property Outlk 'To       "Recipient@server.com")
(vlax-Put-Property Outlk 'Subject  "Subject")
(vlax-Put-Property Outlk 'TextBody "My Message")

(if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list outlk 'Send)))
  (princ "\nImpossible to send the message. No connection Internet")
)

(vlax-Release-Object Outlk)

@+

Tramber

  • Guest
Re: Outlook
« Reply #12 on: August 09, 2006, 02:48:08 AM »
Thanks but I haven't been able to run those lines. Maybe due to the fact that I am currently under an Exchange server (no SMTP from my machine).

But anyway, until now, I'm satisfied with the progs I found in the autodesk.discussion.
I'm still unable to succeed in the use of CreateMHTMLBody method but it doesn't matter for now.....