Jump to content

A "Help me with this drawing" email link


brawleyman

Recommended Posts

Just a side idea should be able to open outlook if not open use same method as excel etc. Or maybe startapp outlook.

 

You can also send and retrieve a file from a valid address this may be easier. Did not read every post.

Edited by BIGAL
Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • brawleyman

    7

  • Lee Mac

    5

  • rlx

    4

  • jpcadconsulting

    3

1 hour ago, BIGAL said:

Just a side idea should be able to open outlook if not open use same method as excel etc. Or maybe startapp outlook.

 

You can also send and retrieve a file from a valid address this may be easier. Did not read every post.

 

@home had already changed the get-object to get-or-create-object but don't have outlook @home so had to wait till I was back @office , and it works...

 

But of course code is longer than the mailto: method. I really don't care about that but that's just me ...😄

 

(defun create-email  (recipients_list subject body attachments_list email_send / acadapp acaddoc outlookapp
                      mail_object recipients_collection attachments_collection temp item )
  (vl-load-com) (setq acadapp (vlax-get-acad-object) acaddoc (vlax-get-property acadapp 'activedocument))
  ;;; Get the existing outlook application object
  (if (or (= (setq outlookapp (vl-catch-all-apply 'vlax-get-or-create-object (list "Outlook.Application"))) nil)
          (/= (type outlookapp) 'vla-object)) (alert "Unable to start Outlook"))
  (if (= (type outlookapp) 'vla-object)
    (if (setq mail_object (vlax-invoke-method outlookapp 'createitem 0)) ;;; Create new email object
      (if (setq recipients_collection (vlax-get-property mail_object 'recipients)) ;;; Get the recipients collection
        (progn
          ;;; Add the recipients properties to the email
          (foreach item  recipients_list (if (= (type item) 'str) (vlax-invoke-method recipients_collection 'add item)))
          ;;; Add the subject properties to the email
          (if (= (type subject) 'str) (vlax-put-property mail_object 'subject subject))
          ;;; Add the body properties to the email
          (if (= (type body) 'str) (vlax-put-property mail_object 'body body))
          ;;; Add the attachements properties to the email
          (if (and (vl-consp attachments_list) (setq attachments_collection (vlax-get-property mail_object 'attachments)))
             (foreach item  attachments_list (if (and (setq temp (findfile item)) (vl-file-systime temp))
                (vlax-invoke-method attachments_collection 'add temp))))
          ;;; If the email_send equals 1 and the recipients_list, subject, and body were passed to the
          ;;; function then send the email, otherwise display the email for the user to finish
          (if (and (= email_send 1) (vl-consp recipients_list) subject body (/= subject "") (/= body ""))
            (vlax-invoke-method mail_object 'send) (vlax-invoke-method mail_object 'display))
          (setq ret t)
        )
        (princ "\nCould not get the recipients collection from the new mail item"))
      (princ "\nCould not create a new mail item through Outlook"))
    (princ "\nCould not create a new instance of Outlook")
  )
  (release_me (list attachments_collection recipients_collection mail_object outlookapp acaddoc acadapp))
  (princ)
)

(defun release_me (l) (mapcar '(lambda (x)
  (if (and (= 'vla-object (type x))(not (vlax-object-released-p x)))(vlax-release-object x))(set (quote x) nil)) l))

(defun C:t1  ()
  ;;; Who's going to get the mail
  (setq recipients_list (list "rlx@home.nl"))
  ;;;  What is the subject
  (setq subject "Subject of the mail")
  ;;; What is the body
  (setq body "Body of the mail")
  ;;; What are the attachments
  (setq attachments_list (list "c:\\temp\\rob.csv"))
  ;;; Do send this mail immediately
  (create-email recipients_list subject body attachments_list 1)
  ;;; Do not yet send this mail use : (create-email recipients_list subject body attachments_list 0)
  (princ)
)

Edited by rlx
Link to comment
Share on other sites

I have windows live mail but can not find ID for get-create

 

Maybe this, locked out will try running at admin level.

 

We would like to set a few default app associations via GPO. Apparently in Windows 10, you can set all default apps on your image and then export an XML with DISM.exe which contains all associations.

Dism.exe /online /export-defaultappassociations:C:\AppAssociations

Found onenote works 

Link to comment
Share on other sites

Yeah I know what what you mean bigal , tried to find it too how to send with live mail but it seems then you will have to use the :mailto option



Hi,

Unfortunately WLM offers no automation model for VBA.  I prefer sending SMTP via CDO.  You can find some examples at the Utter Access Code Archive (although I believe you'll have to register to download)

http://www.utteraccess.com/forum/Categorized-Table-Conten-t1980020.html#Email

(I prefer this one: http://www.utteraccess.com/forum/index.php?showtopic=1957295 )

hth

Jack D. Leach (Access MVP)
UtterAccess Wiki: (Articles, Functions, Classes, VB7 API Declarations and more)

 

Link to comment
Share on other sites

  • 1 year later...

Was looking at this again playing with Mailto lots of combinations but could only get mail to open and a subject or body to appear.

 

Desire (command "_.start"  "mailto:info@alanh.com.au?subject=my%20report&body=see%20attachment&attachment=d:\acadtemp\bricscad.log")

 

Looking at the (vlax-get-object "Outlook.Application") method returns nil I dont want to install Outlook just for this task. Do not want to screw up my emails.

 

Back to the question is there  ?????????.application for Mail.

Link to comment
Share on other sites

  • 11 months later...
On 5/9/2012 at 1:38 AM, Lee Mac said:

Maybe:

 

 


(defun _mailfile ( filepath )
   (while (vl-string-position 32 filepath)
       (setq filepath (vl-string-subst "%20" " " filepath))
   )
   (setq filepath (vl-string-translate "\\" "/" filepath))
   (command "_.start"
       (strcat
           "mailto:me.myself.and.i@someemail.com?body=Here%20is%20the%20file:%20file:///"
           filepath
       )
   )
   (princ)
)
 

 

 

How can I insert the DWGPREFIX as a link in the "Body"? It only comes out as pure text.

 

(vlax-put-property objMail 'Body (getvar "DWGPREFIX"))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...