Link to home
Create AccountLog in
Avatar of Rob4077
Rob4077Flag for Australia

asked on

Problem checking senderemailaddress with VBA

I have developed some VBA that is intended to create an auto reply to a correctly formatted message. However step one of the process is to check the senderemailaddress and I am having trouble with senders from my own domain. Instead of the senderemailaddress coming in as username@mydomain.com it's coming in as something like: "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FY....LT)/CN=RECIPIENTS/CN=5959...E-USERNAME"  How can I get the normal format username to test for validity
Avatar of DrTribos
DrTribos
Flag of Australia image

In the string... is the username accurately presented in the string?  If so, can you just append the username to your domain name to recreate the email address?

There are a few ways to extract a username from a string, but you may need to identify a pattern...

e.g.  assuming the username is preceded by "..." and forms the rest of the string (and there are no other occurrences of "..." in the string) then you could do something like:
myUsername = split(string, "...")(0)

Open in new window

Avatar of Rob4077

ASKER

Hi, thanks for your comment. I didn't post the full address as I wasn't sure of security implications with other people on the net but I will now post it in full senderemailaddress string, albeit in a scrambled format. As you can see the last part of the address is the username which happens to be the user name part of the true email address so I can do an instrrev and grab what comes after the last "-" in the string but I was hoping there would be a more robust option. Is there no safer way?

/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBPI3I3SYDIT)/CN=RECIPIENTS/CN=5978029F591240D597AA8DEF8111AF2E-USERNAME


The senderemailaddress I am searching for is username@mydomain.com.au
ASKER CERTIFIED SOLUTION
Avatar of DrTribos
DrTribos
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Rob4077

ASKER

Sorry for the delay in finalising this. I am finally back to it and will use your suggestion. Thanks
Tnx :-)