Closed Intrflex closed 3 years ago
Hi there, bcc recipients are not part of the header of an email, they are exchanged during the envelope exchange between sending and receiving mail server.
Hi there, bcc recipients are not part of the header of an email, they are exchanged during the envelope exchange between sending and receiving mail server.
so does that mean I'm unable to get the value? as I can see it in the raw mime or is it a case of I have to match the string with regex?
Hi @Intrflex -- there should be no issue reading Bcc if it's part of the mime message you're parsing. Could you paste the full email's headers here (obfuscating addresses, etc... if need be) and the code you're using to read the header?
Thank you for the replies, I managed to solve this I was simply looking in the wrong area, however, I do have another issue when parsing the emails attachments both inline and normal, once I've uploaded the file to my s3 storage how can I then remove that attachment from the message before storing in the database
here's an example of my code
foreach ($message->getAllAttachmentParts() as $ind => $part) { $filename = $part->getHeaderParameter( 'Content-Type', 'name', $part->getHeaderParameter( 'Content-Disposition', 'filename', '__unknown_file_name_' . $ind ) ); $file = explode('.', $filename); $length = count($file) - 1; $fileExtension = $file[$length]; if($part->getContentDisposition() !== 'inline') { $filename = Uuid::uuid4() . '.' . $fileExtension; $fileToUpload = File::create(['url' => '/FILES/' . tenant()->stripe_id . '/Emails/' . $filename . '.' . $fileExtension, 'name' => $filename]); $files[] = $fileToUpload; } Storage::disk('s3')->put('/FILES/' .tenant()->stripe_id . '/Emails/'. $filename, $part->getContent()); unset($message->getAllAttachmentParts()[$ind]); }
i want to remove the current from the parsed email before storing it $message->getAllAttachmentParts()[$ind];
best regards
$message->removeAttachmentPart(0);
for example, I send an email to help@zbateson.com, and I bcc in test@example.com when I parse the email received at test@example.com, I'm unable to get the original email that was Bcc'd so I need to access the value which contains "test@example.com"
the emails that are Bcc'd are wildcards and parsed on the server from the domain so the domain is looking for anything that has @example.com to find the tenant mapping the first part of the email to the representative tenant
I hope this makes sense