Author Topic: sending email via acad  (Read 3827 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
sending email via acad
« on: March 18, 2013, 11:41:43 AM »
trying to send email via acad and my outlook get a popup saying "a program is
trying to send email do i want to allow or deny it.."

has anyone else gotten this message and is there a way to get around it?
im using outlook 2007

here is the code im using
Code: [Select]
(defun email ()
         (setq olApp (vlax-get-or-create-object "Outlook.Application"))
         (setq objMail (vlax-invoke olApp 'CreateItem 0))
         (vlax-put-property objMail 'Subject "testing")
         (vlax-put-property objMail 'To "test email@test.com") 
         (vlax-put-property objMail 'Body "testing")
         (vlax-invoke objMail 'Send)
)

ronjonp

  • Needs a day job
  • Posts: 7531
Re: sending email via acad
« Reply #1 on: March 18, 2013, 11:51:12 AM »
There was not an answer when you asked back in 2010 ? I would think it's related to a security setting.
http://www.theswamp.org/index.php?topic=36083.msg412060#msg412060
« Last Edit: March 18, 2013, 11:54:16 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: sending email via acad
« Reply #2 on: March 18, 2013, 11:55:23 AM »
You have a long memory grasshopper.  :lol:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: sending email via acad
« Reply #3 on: March 18, 2013, 11:57:51 AM »
You have a long memory grasshopper.  :lol:

 :-D If only that were true...

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

andrew_nao

  • Guest
Re: sending email via acad
« Reply #4 on: March 18, 2013, 12:02:48 PM »
i think it might have something to do with

(vlax-put objMail 'FlagRequest "1")

but when i enter this code or any other code in, line by line manually on the command line, i get nil for my return response.


andrew_nao

  • Guest
Re: sending email via acad
« Reply #5 on: March 18, 2013, 12:05:12 PM »
There was not an answer when you asked back in 2010 ? I would think it's related to a security setting.
http://www.theswamp.org/index.php?topic=36083.msg412060#msg412060

ahh there is the post... i couldnt find it, i knew i asked before.

and in 3 years i have no solution... :(

andrew_nao

  • Guest
Re: sending email via acad
« Reply #6 on: March 18, 2013, 12:12:57 PM »
If your computer is managed by a Microsoft Exchange administrator or a Microsoft Windows Active Directory Domain Services administrator in your organization, and the administrator changes the default setting and prevents users from making changes, the option to customize the Programmatic Access security settings will be disabled.
If your computer is not managed by an Exchange administrator or a Microsoft Windows Active Directory Domain Services administrator, and you are the Windows administrator of your computer, you can change the Programmatic Access security settings. However, this is not recommended.

the answer to my question

thanks for the replys

Patrick_35

  • Guest
Re: sending email via acad
« Reply #7 on: March 18, 2013, 12:58:19 PM »
Hi

And with "CDO.Message" ?

For example
Code: [Select]
(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")
(vlax-invoke outlk 'AddAttachment "My_Text.txt")

(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)

@+

andrew_nao

  • Guest
Re: sending email via acad
« Reply #8 on: March 18, 2013, 01:19:12 PM »
Hi

And with "CDO.Message" ?

For example
Code: [Select]
(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")
(vlax-invoke outlk 'AddAttachment "My_Text.txt")

(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 for the reply

still wont work, the error message kicks in

thanks though

BlackBox

  • King Gator
  • Posts: 3770
Re: sending email via acad
« Reply #9 on: March 18, 2013, 01:20:55 PM »
has anyone else gotten this message and is there a way to get around it?
im using outlook 2007

FWIW... I got around this issue by upgrading to Office 2010... Not sure if that option is available to you, but it works.  :-)
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: sending email via acad
« Reply #10 on: March 19, 2013, 01:44:13 AM »
You could of course use something like a command-line emailing client: http://www.techsupportalert.com/content/send-email-windows-command-line.htm
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.