I'm using latest Grav 1.7 RC17 version. Developing a new project locally.
I've set email plugin with external SMTP server and it does send mails.
The problem is with a contact form.
I've made a validation and Ajax submission.
The email field is not mandatory and here comes this error:
Address in mailbox given [] does not comply with RFC 2822
If I fill the email input - no error.
I've seen that a few people had this problem long before and no fix was provided.
In some similar mailing projects the solution is pretty simple - use additional trim functions in php code to allow empty email if it's not required.
The full error from console.log:
"{\"error\":{\"type\":\"Swift_RfcComplianceException\",\"message\":\"Address in mailbox given [] does not comply with RFC 2822, 3.6.2.\",\"file\":\"C:\\\\xampp\\\\htdocs\\\\project\\\\user\\\\plugins\\\\email\\\\vendor\\\\swiftmailer\\\\swiftmailer\\\\lib\\\\classes\\\\Swift\\\\Mime\\\\Headers\\\\MailboxHeader.php\",\"line\":355}}"
I'm using latest Grav 1.7 RC17 version. Developing a new project locally. I've set email plugin with external
SMTP
server and it does send mails.The problem is with a contact form. I've made a validation and Ajax submission. The email field is not mandatory and here comes this error:
Address in mailbox given [] does not comply with RFC 2822
If I fill the email input - no error. I've seen that a few people had this problem long before and no fix was provided. In some similar mailing projects the solution is pretty simple - use additional trim functions in php code to allow empty email if it's not required.Here is my form:
And jQuery validation from jqueryvalidation.org:
The full error from
console.log
:"{\"error\":{\"type\":\"Swift_RfcComplianceException\",\"message\":\"Address in mailbox given [] does not comply with RFC 2822, 3.6.2.\",\"file\":\"C:\\\\xampp\\\\htdocs\\\\project\\\\user\\\\plugins\\\\email\\\\vendor\\\\swiftmailer\\\\swiftmailer\\\\lib\\\\classes\\\\Swift\\\\Mime\\\\Headers\\\\MailboxHeader.php\",\"line\":355}}"