Help with Outlook VBA code required?

J

Jazsnap

I've written some very basic VBA code within Outlook in order to warn users
who send emails above the company's maximum allowed file size. The code
brings up a message box informing them that the email is in excess of the
company's email policy & gives them the opportunity to cancel; if they
choose to send the email regardless, the time, file size & username are
written to an internal database.

I would like to modify the script for our laptop users so that I can
somehow ascertain whether the user is logged on to our internal network
(Windows 200 domain) or not. This will enable me to only check emails that
are sent through our internal network & allow them to send whatever they
want from home or wherever. What would be the best check to perform for
this purpose? I have tried the below but even if users logon to their
laptops disconnected from our network "WshNetwork.UserDomain" still matches
our windows domain.

Set WshNetwork = CreateObject("WScript.Network")
If WshNetwork.UserDomain <> "<our windows domain>" Then Exit Sub

Any help would be appreciated, Jason
 
C

Chirag

I think you should check for the account through which the message is being
sent. If the account points to your corporate mail server, then apply your
corporate policies. The MailItem object provides access to the Account
object through the SendUsingAccount property.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
J

Jazsnap

I think you should check for the account through which the message is
being sent. If the account points to your corporate mail server, then
apply your corporate policies. The MailItem object provides access to
the Account object through the SendUsingAccount property.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

Hi Chirag and thanks for the suggestion, unfortunately we don't host our
own email servers so all our devices point directly to an external mail
server. The only difference is that internal devices point to an alias
for the external mail server which gets resolved by our internal DNS,
whereas mobile devices point directly to the mail server, could we use
this as a check, if so do you know what command I should use?

Regards,
Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top