Checking for Bad E-mail Addresses in CRM -This Quick Campaign could not be performed due to an error: 0x8004020f
I was getting an error:
This Quick Campaign could not be performed due to an error: 0x8004020f. For more information, contact your system administrator.
I hate these messages because I am the administrator. So when I look at myself and don't know the answer, I turn to Google search. Funny enough, there is only one other article on the web from Meno regarding this issue. However, no remedy was offered and there was nothing in the MSFT KB. So I was on my own. As it turns out we had bad e-mail addresses. What I did was write a simple query that looks for the @ and a (.) in the e-mail field. This returns bad addresses. We went in manually and fixed the few hundred e-mails that the query spit out.
It would be nice if someone came up with a web service you could call via Java to do this stuff in realtime. Because there is nothing preventing an import from adding bad e-mails. An onchange event on the form might help.
How does it work? First we are checking for imbedded spaces, next a @ can't be at the beginning, (.) can't be at the end, and there has to be a (.) after the @, only 1 @, Domain should have at least 2 characters, and can't have (..).
Contacts is the same query but just a different table
SELECT FullName, EMailAddress1
FROM Contact
WHERE (NOT (CHARINDEX(' ', LTRIM(RTRIM(EMailAddress1))) = 0)) OR
(NOT (LEFT(LTRIM(EMailAddress1), 1) <> '@')) OR
(NOT (RIGHT(RTRIM(EMailAddress1), 1) <> '.')) OR
(NOT (CHARINDEX('.', EMailAddress1, CHARINDEX('@', EMailAddress1)) - CHARINDEX('@', EMailAddress1) > 1)) OR
(NOT (LEN(LTRIM(RTRIM(EMailAddress1))) - LEN(REPLACE(LTRIM(RTRIM(EMailAddress1)), '@', '')) = 1)) OR
(NOT (CHARINDEX('.', REVERSE(LTRIM(RTRIM(EMailAddress1)))) >= 3)) OR
(NOT (CHARINDEX('.@', EMailAddress1) = 0 AND CHARINDEX('..', EMailAddress1) = 0))
Leads you can get by just changing the table name
SELECT FullName, EMailAddress1
FROM Leads
WHERE (NOT (CHARINDEX(' ', LTRIM(RTRIM(EMailAddress1))) = 0)) OR
(NOT (LEFT(LTRIM(EMailAddress1), 1) <> '@')) OR
(NOT (RIGHT(RTRIM(EMailAddress1), 1) <> '.')) OR
(NOT (CHARINDEX('.', EMailAddress1, CHARINDEX('@', EMailAddress1)) - CHARINDEX('@', EMailAddress1) > 1)) OR
(NOT (LEN(LTRIM(RTRIM(EMailAddress1))) - LEN(REPLACE(LTRIM(RTRIM(EMailAddress1)), '@', '')) = 1)) OR
(NOT (CHARINDEX('.', REVERSE(LTRIM(RTRIM(EMailAddress1)))) >= 3)) OR
(NOT (CHARINDEX('.@', EMailAddress1) = 0 AND CHARINDEX('..', EMailAddress1) = 0))
This will show accounts:
SELECT Name,EMailAddress1
FROM Account
WHERE (NOT (CHARINDEX (' ', LTRIM(RTRIM(EMailAddress1))) = 0)) OR
(NOT (LEFT(LTRIM(EMailAddress1), 1) <> '@')) OR
(NOT (RIGHT(RTRIM(EMailAddress1), 1) <> '.')) OR
(NOT (CHARINDEX('.', EMailAddress1, CHARINDEX('@', EMailAddress1)) - CHARINDEX('@', EMailAddress1) > 1)) OR
(NOT (LEN(LTRIM(RTRIM(EMailAddress1))) - LEN(REPLACE(LTRIM(RTRIM(EMailAddress1)), '@', '')) = 1)) OR
(NOT (CHARINDEX('.', REVERSE(LTRIM(RTRIM(EMailAddress1)))) >= 3)) OR
(NOT (CHARINDEX('.@', EMailAddress1) = 0 AND CHARINDEX('..', EMailAddress1) = 0))
simply brilliant!
thank you very much for taking the time to document this issue.
- vinh
Reply to this