VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to access emails using AutoCAD VBA?

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
510 Views, 4 Replies

Is it possible to access emails using AutoCAD VBA?

Good morning,

 

I would like to know if it is possible to access an email account, select a date and then read the email subject line and sender with AutoCAD. The result would be a message in AutoCAD listing the email subjects and the senders for today's date.

 

As you may have guessed, I am learning VBA for AutoCAD and I am wondering if that's something feasible.

 

Thanks in advance for your help,

 

ML

4 REPLIES 4
Message 2 of 5
norman.yuan
in reply to: Anonymous

Dpending on how you want to access the emails, there could be different ways to do what you want. But with VBA, it would be quite dificult in somce cases.

 

Firstly, where you want to get the email. If you want to dirrectly access the email server, then what the email server is, what the email protocol is (SMTP, or MAPI, POP3...), your LAN Exchange Server, or external email server (Gmail, Hotmail...).

 

With VBA, you may need third party component (such as EASendMail.dll) and if you use 64-bit AutoCAD VBA (acad2014/15), you have to make sure the ccomponent is 64-bit.

 

if the CAD computer has Outlook installed, and the emails in interest always send to current login user, then you can automate Outlook to scann emails received by Outlook, instead of going to email server.

 

With .NET language (C#, VB.NET) accessing email server would be a lot easier. There are many code samples you can find if googling the net (you can also find some code samples on this with old VB/VBA, but they are mostly quite outdated and depened on third party components and most likely not 64-bit).

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5
Anonymous
in reply to: norman.yuan

Hi, Thanks for your quick response. I really appreciate it.

 

Apparently, what I want to do is difficult and since I am not proficient in VBA for AutoCAD I should probably try something else. You may have a better idea of what I should do if I give you more details: my goal is to create a program that accesses an email account, reads the subject and sender of the emails received today and returns this info. The advantage is that anyone can check the emails received today and there is no need to login to that email account.

 

The emails are related to CAD and this is why I wanted to do in VBA. But it could be independent from CAD and could be a program lauched from a destok for example.

 

Do you know if that's feasible? If there is any sample for this on the internet, could you show me where? I did not find anything.

 

Thanks!

 

ML

Message 4 of 5
norman.yuan
in reply to: Anonymous

Since you mentioned that you also want it to be a desktop app that can retrieve email information, I'd definitely do it with .NET (C# or VB.NET), so that the code for email retrieving can be shared by AutoCAD and the desktop app, and do not have to worry the hosting app (AutoCAD or the desktop app) being 32-bit or 64-bit.

 

Then, you need to tell where the email box is hosted: your LAN email server (such as Exchange Server) or other type of email server. This may dictate what programming API you need to use to access emal box.

 

Assume your enviroment uses MS Exchange Server to host email, then you need to know the domain user account name( and its password), to which a email box is assigned. If the Exchange Server is fairly up-to-date, it exposes managed (.NET) web service API (EWS) for external application to access/manlpulate emal boxes hosted in Exchange Server.

 

For more information on how to use EWS to access email in Excahnge Server, look at this:

 

http://msdn.microsoft.com/EN-US/library/office/dn567668(v=exchg.150).aspx

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5
Anonymous
in reply to: norman.yuan

Ok, thank you! It seems quite difficult to do but I will look at the link you gave me and hopefully I will learn how to do it. Thanks again!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost