@larsr2866 schrieb:
Unfortunately, the attachement doesn't work with an existing file either.
So it is absolutely uninteresting that you "new" pdf won't work,
the problem is more generally: The code dosn't work with attachments (for you).
Right? ok
Maybe i should try to get this working with a pop up a window to select my file (user imput),
Please, if you are not able to add an absolute/fix path with already existing files, how or why should it works with an user dialog to select a file?
but i don't know this is even possible within acad?
Sure&Easy, but you don't need that and you problem is another one.
Your way to think is...sub-optimal 🙂
Now, I have the schnauze voll (LOO, It's DENGLISCH, Deutsch/Englisch and means "it is enough" 😉 )
I created a new mail account
I installed outlook
I setup my new outlook with my new mail account
and tested.
'It works at the first try!
(defun ONL:SENDMAIL (an Betreff Inhalt Anhang / MAIL OLOBJ)
(vl-load-com)
(setq OLOBJ (vlax-Get-Or-Create-Object "Outlook.Application")
MAIL (vlax-invoke-method OLOBJ "CreateItem" 0)
)
(vlax-invoke-method (vlax-get-property MAIL 'recipients) 'add an)
(if (and Anhang (findfile Anhang))
(vlax-invoke-method (vlax-get-property MAIL 'attachments)'add (findfile Anhang))
)
(vlax-put-property MAIL 'subject betreff)
(vlax-put-property MAIL 'body Inhalt)
(vlax-invoke-method MAIL 'send)
(vlax-release-object OLOBJ)
(princ)
)
;; TEST - (ONL:SENDMAIL "cadffm@nurfuerspam.de" "Testmail with attachment" "Body" "D:\\PDFEXT1.pdf")
MY hint: Search in www for :
AutoCAD Outlook.Application CreateItem
to find more sample codes.
Sample with a fix path/file
(ONL:SENDMAIL "cadffm@nurfuerspam.de" "Topic" "Body" "D:\\PDFEXT1.pdf")