Here is the code that I am using and the issure that is left behind. Any suggestion on another way or how to do it the way I am currently I would be greatful.
START-CHECK-EMAIL-ADDRESS.
*Reset counters.
MOVE ZEROS TO WS-AT-SYMBOL.
MOVE ZEROS TO WS-PERIODS.
MOVE ZEROS TO WS-EMAIL-SPACES.
*Check the address to make sure that it have at least one @ however no more than one.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-AT-SYMBOL
FOR ALL "@".
IF WS-AT-SYMBOL < 1 OR WS-AT-SYMBOL > 1
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
aaaaaa@aaaaaaaa.com
aaaaaa@
aaaaaa@aaa aaaaa.c om
Example of failed:
aaaaaaaaaaaaaa.com
aaaa.aaaaaaaaaaaaa.com
aaaaaaaaa aaaaa.a aa
*Check to make sure that the address contains atleast one period, there can be multiple periods in an email address.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-PERIODS
FOR ALL ".".
IF WS-PERIODS < 1
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
a aaaaa@aaaaaaaa.com
aaaaaa@aaa aaaaa.a aa
aaaa.aa aaa@aaa.aaaaa.com
Example of failed:
aaaaaa@aaaaaaaacom
aaaaaa@aaa aaaaa com
aaaa aaaaa@aaa aaaaa com
*Check to make sure that the address does not contains any spaces prior to the @.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-EMAIL-SPACES
FOR ALL SPACES
BEFORE "@".
IF WS-EMAIL-SPACES > 0
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
aaaaaa@aaa aaaaa.com
aaaaaa@aaa aaaaa.c om
aaaa.aaaaa@aaa.aaaaa.com
Example of failed:
a aaaaa@aaaaaaaa.com
aaa aaa@aaa aaaaa. com
aaaa aaaaa@aaa aaaaa. com
*Check to make sure that the address does not contains any spaces after the @ but before the ".".
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-EMAIL-SPACES
FOR ALL SPACES
AFTER "@"
BEFORE ".".
IF WS-EMAIL-SPACES > 0
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
END-CHECK-EMAIL-ADDRESS.
EXIT.
Example of test passed:
aaaaaa@aaaaaaaa.c o m
aaaaaa@aaaaaaaa.c om
aaaa.aaaaa@aaa.aaaaa. com
Example of failed:
aaaaaa@a aaaaaaa.com
aaaaaa@aaa aaaaa. com
aaaa.aaaaa@a aaaaaaa. com
The only condition that I can figure how to test is after the final period to end of the email address.
Example of emails that slip through
aaaaaa@aaaaaaaa. com
aaaa.aaaaa@aaaaaaaa.c o m
aaaa@aaaaaaaa.
aaaa@aaaaaaaa.co m
START-CHECK-EMAIL-ADDRESS.
*Reset counters.
MOVE ZEROS TO WS-AT-SYMBOL.
MOVE ZEROS TO WS-PERIODS.
MOVE ZEROS TO WS-EMAIL-SPACES.
*Check the address to make sure that it have at least one @ however no more than one.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-AT-SYMBOL
FOR ALL "@".
IF WS-AT-SYMBOL < 1 OR WS-AT-SYMBOL > 1
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
aaaaaa@aaaaaaaa.com
aaaaaa@
aaaaaa@aaa aaaaa.c om
Example of failed:
aaaaaaaaaaaaaa.com
aaaa.aaaaaaaaaaaaa.com
aaaaaaaaa aaaaa.a aa
*Check to make sure that the address contains atleast one period, there can be multiple periods in an email address.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-PERIODS
FOR ALL ".".
IF WS-PERIODS < 1
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
a aaaaa@aaaaaaaa.com
aaaaaa@aaa aaaaa.a aa
aaaa.aa aaa@aaa.aaaaa.com
Example of failed:
aaaaaa@aaaaaaaacom
aaaaaa@aaa aaaaa com
aaaa aaaaa@aaa aaaaa com
*Check to make sure that the address does not contains any spaces prior to the @.
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-EMAIL-SPACES
FOR ALL SPACES
BEFORE "@".
IF WS-EMAIL-SPACES > 0
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
Example of test passed:
aaaaaa@aaa aaaaa.com
aaaaaa@aaa aaaaa.c om
aaaa.aaaaa@aaa.aaaaa.com
Example of failed:
a aaaaa@aaaaaaaa.com
aaa aaa@aaa aaaaa. com
aaaa aaaaa@aaa aaaaa. com
*Check to make sure that the address does not contains any spaces after the @ but before the ".".
INSPECT DEI-OUTBOUND-EMAIL-ADDRESS
TALLYING WS-EMAIL-SPACES
FOR ALL SPACES
AFTER "@"
BEFORE ".".
IF WS-EMAIL-SPACES > 0
MOVE WS-SETON TO DEO-INVALID-EMAIL-ADDRESS
MOVE WS-MESSAGE-06 TO DEO-MESSAGE-TEXT
GO TO END-CHECK-EMAIL-ADDRESS
END-IF.
END-CHECK-EMAIL-ADDRESS.
EXIT.
Example of test passed:
aaaaaa@aaaaaaaa.c o m
aaaaaa@aaaaaaaa.c om
aaaa.aaaaa@aaa.aaaaa. com
Example of failed:
aaaaaa@a aaaaaaa.com
aaaaaa@aaa aaaaa. com
aaaa.aaaaa@a aaaaaaa. com
The only condition that I can figure how to test is after the final period to end of the email address.
Example of emails that slip through
aaaaaa@aaaaaaaa. com
aaaa.aaaaa@aaaaaaaa.c o m
aaaa@aaaaaaaa.
aaaa@aaaaaaaa.co m