VLISP可以通过ACTIVEX 使用系统的邮件客户端,比如OUTLOOK发送EMAIL,而QQ邮箱的SMTP你可以设置到OUTLOOK里面
下面是代码,可以发送附件
 - ;; Outlook Message - ronjonp (modified slightly by Lee Mac :-)
- ;; rcp - [str] Email 地址 (多个地址用分号隔开)
- ;; sub - [str] 主题
- ;; bdy - [str] 内容
- ;; att - [lst]附件表
- ;; snd - [bol] T=发送; nil=打开编辑邮件内容
- (defun rjp-outlookmessage ( rcp sub bdy att snd / atm msg out rtn )
- (if (setq out (vlax-get-or-create-object "outlook.application"))
- (progn
- (setq rtn
- (vl-catch-all-apply
- '(lambda nil
- (setq msg (vlax-invoke-method out 'createitem 0)
- atm (vlax-get msg 'attachments)
- )
- (vlax-put msg 'to rcp)
- (vlax-put msg 'subject sub)
- (foreach fnm att
- (if (setq fnm (findfile fnm))
- (vlax-invoke atm 'add fnm)
- )
- )
- (if snd
- (vlax-invoke msg 'send)
- (vlax-invoke msg 'display :vlax-true)
- )
- t
- )
- )
- )
- (foreach obj (list atm msg out)
- (if (= 'vla-object (type obj))
- (vlax-release-object obj)
- )
- )
- (if (vl-catch-all-error-p rtn)
- (prompt (vl-catch-all-error-message rtn))
- rtn
- )
- )
- )
- )
上面函数用法:
 - (defun c:mp ( / dir )
- (if (zerop (getvar 'dwgtitled))
- (princ "\nCurrent drawing is unsaved.")
- (rjp-outlookmessage
- "Jeremiah.Parsons@applusrtd.com"
- (getvar 'dwgname)
- (strcat
- (setq dir (vl-string-right-trim "\\" (getvar 'dwgprefix)))
-
- )
- (vl-remove-if
- '(lambda ( x )
- (wcmatch (vl-filename-extension x) ".log,.bak,.dwl2,.dwl")
- )
- (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir nil 1))
- )
- nil
- )
- )
- (princ)
- )
|