TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Tramber 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 ?
-
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
-
I thank you but I'm alergic to VBA. But it must be translatable :angel:
-
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
(setq wsh (vlax-create-object "WScript.Shell"))
(setq app (vlax-invoke wsh 'exec "C:\\Program Files\\Outlook Express\\msimn.exe"))
And to close outlook
(vlax-invoke app 'terminate)
@+
-
Tiens tiens !
Good job !
I'll have a look soon.
-
I have advanced in my research
That should normally function but I could'nt test
(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
(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)
@+
-
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) ?
-
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:
-
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 ^-^
-
I've tried a :
(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-))
-
(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
@+
-
The solution :-)
(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)
@+
-
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.....