How to fix INVALID_EMAIL_ADDRESS in Salesforce deployments
A record being saved has a value in an email field that doesn't match Salesforce's email format validation.
Surfaces during: runtime DML, most often Apex test setup or a data loadWhat it means
INVALID_EMAIL_ADDRESS means a field marked as an Email type on the object received a value Salesforce's built-in format check rejects, missing an @ symbol, an invalid domain shape, or stray whitespace. Salesforce validates email fields at the platform level regardless of any custom validation rules, so this fires even on objects with no email-specific automation of their own.
Salesforce's built-in check is intentionally permissive about what counts as a valid domain, so most real-world addresses pass; the values that fail are almost always synthetic test or placeholder data rather than genuine typos in real customer emails.
Common causes
The fix
- Fix the offending value at the sourceCorrect the malformed address in the test fixture or source data rather than working around the field's validation.
- Use well-formed addresses in fixturesStandardize on a pattern like [email protected] for generated test data so it always passes email validation.
String testEmail = 'test-user+' + String.valueOf(Math.abs(Crypto.getRandomInteger())) + '@example.com'; - Audit the migration's field mappingConfirm the source column feeding the Email field actually contains email addresses before the next load runs.
How Serpent prevents this
Because Serpent runs the full test suite, including any data setup, on every task before merge, a malformed email in test fixtures surfaces on the branch that introduced it instead of blocking a production release later. See the Salesforce deployment error library.

Prevention
Related errors
INVALID_EMAIL_ADDRESS, answered
Start free. No credit card, no install, no commitment.
Set up in under 15 minutes. No DevOps hire needed.
