Jump to content
brawleyman

A "Help me with this drawing" email link

Recommended Posts

BIGAL
Posted (edited)

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

Share this post


Link to post
Share on other sites
rlx
Posted (edited)
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

Share this post


Link to post
Share on other sites
BIGAL

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 

Share this post


Link to post
Share on other sites
rlx

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)

 

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...