Reputation: 130
I keep getting a fatal error message when getting multiple emails from firebase to php (passing data from firebase to HTML then to html to PHP)
Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [[email protected],[email protected]] does not comply with RFC 2822, 3.6.2
I tried getting a single email from firebase and it worked perfectly, but multiple emails with any email addressed I used the same issue arise
<?php
require '/Vendor/Mail/lib/swift_required.php';
// validation expected data exists if required later
if (!isset($_POST['agent_e']) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$email_to = $_POST['agent_e']; // required
$headers .= "MIME-Version: 1.0\r\n";
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('')
->setSubject($subject)
->setFrom(array('[email protected]' => 'mailer'))
->setTo(array($email_to))
->setBody('<html>' .
' <body>' .
' ' . // Embed the file
$messageBody .
' ' .
' </body>' .
'</html>',
'text/html' // Mark the content-type as HTML
);
// Send the message
$result = $mailer->send($message);
Emails from database example :
Error :
Upvotes: 0
Views: 125
Reputation: 130
i solved the problem with Splitting the emails i got from firebase to an array
as below code :
$email_to = str_replace(' ','',$email_to);
$email_to = (string) $email_to;
$email_to = explode(',',$email_to);
Upvotes: 0