Rob4077
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=EXCHAN GE ADMINISTRATIVE GROUP (FY....LT)/CN=RECIPIENTS/C N=5959...E -USERNAME" How can I get the normal format username to test for validity
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=EXCHANG E ADMINISTRATIVE GROUP (FYDIBPI3I3SYDIT)/CN=RECIP IENTS/CN=5 978029F591 240D597AA8 DEF8111AF2 E-USERNAME
The senderemailaddress I am searching for is username@mydomain.com.au
/O=EXCHANGELABS/OU=EXCHANG
The senderemailaddress I am searching for is username@mydomain.com.au
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Sorry for the delay in finalising this. I am finally back to it and will use your suggestion. Thanks
Tnx :-)
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:
Open in new window