Email does not comply with addr-spec of RFC 2822. Laravel
This error message indicates that the email address you’re attempting to use doesn’t adhere to the specific formatting guidelines outlined in RFC 2822. This RFC is a fundamental standard for email addresses, defining the correct syntax and structure.
Common Reasons for Non-Compliance:
- Missing or Incorrect ‘@’ Symbol: The ‘@’ symbol separates the local part (the username) from the domain part (the email provider). Its absence or incorrect placement is a common cause of this error.
- Invalid Local Part: The local part can contain letters (both uppercase and lowercase), numbers, underscores, hyphens, and periods. However, it cannot start or end with a period, and consecutive periods are not allowed.
- Invalid Domain Part: The domain part typically consists of one or more domain names separated by periods. Each domain name should adhere to specific rules, such as not starting or ending with a hyphen.
- Whitespace or Special Characters: Email addresses should not contain any whitespace characters (spaces, tabs, etc.) or special characters (except those allowed in the local and domain parts).
- Case Sensitivity: While email addresses are generally case-insensitive, some systems might be more strict about case. Ensure that the case of the characters matches the expected format.
Example of a Valid Email Address:
Example of an Invalid Email Address:
john [email protected] // Missing '@' and whitespace
[email protected] // Invalid local part with consecutive periods
example@ // Missing domain part
Troubleshooting Steps:
- Double-check the Email Address: Carefully review the email address for any typos, missing characters, or incorrect formatting.
- Consult RFC 2822: If you need more detailed information, refer to the RFC 2822 specification.
- Use an Online Validation Tool: There are many online tools available that can validate email addresses based on RFC 2822.
By addressing these common issues and following the guidelines in RFC 2822, you can ensure that your email addresses are valid and compliant.
Simple solution to fix this issue is:
make array of multiple emails like below: