Уже некоторое время ищу решение и попробовал пару вещей, одну из которых вы можете увидеть в моем коде, но, тем не менее, она все еще не удаляет блоки заявления об отказе от ответственности и подписи в «теле» файла. электронная почта.
Это просто действие по электронной почте в MySQL, получение заявления об отказе от ответственности/подписи электронной почты и вставка в базу данных.
Будем рады любым предложениям!
function stripSignatureAndDisclaimer($html) {
// Define patterns to match and remove
$patterns = array(
'/
\s*Signature\s*.*?/is', // Matches Signature: ...
(case insensitive and multi-line)
'/
\s*Disclaimer\s*.*?/is', // Matches Disclaimer: ...
(case insensitive and multi-line)
'/\s*Signature\s*.*?/is', // Matches Signature: ... (case insensitive and multi-line)
'/\s*Disclaimer\s*.*?/is', // Matches Disclaimer: ... (case insensitive and multi-line)
'/
\s*Signature\s*.*?$/is', // Matches
Signature: ... (case insensitive and multi-line)
'/
\s*Disclaimer\s*.*?$/is', // Matches
Disclaimer: ... (case insensitive and multi-line)
'/
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*.*?$/is', // Matches
************ (case insensitive and multi-line)
'/
\s*(Best Regards|Sincerely|Yours sincerely|Kind Regards|Thanks)\s*,?\s*/i', // Matches common sign-off phrases
'/\s*(Department of housing|Local Government)\s*,?\s*/i', // Matches common signature div blocks
'/
\s*(Best Regards|Sincerely|Yours sincerely|Kind Regards|Thanks),?\s*
.*?/is', // Matches
Best Regards,...
CEO, Example Inc.
'/\s*Disclaimer:\s*.*?/is', // Matches disclaimer blocks
'/\s*\*+ Disclaimer \*+.*?/is' // Matches disclaimer block starting with ***
);
// Remove matching patterns from HTML
foreach ($patterns as $pattern) {
$html = preg_replace($pattern, '', $html);
}
return $html;
}
// Strip signature and disclaimer from HTML body
$body = stripSignatureAndDisclaimer($body);
$subject = addslashes($subject); // Escape single quotes
$from = addslashes($from);
$date = addslashes($date);
$body = addslashes($body);
// Insert into MySQL database
// Вывод в файл PHP
Email Details
Date Received
Sender
Subject
Body
No results found for project ID
Вывод электронного письма на экран (я удалил некоторые сведения о своей компании)
-_000_SYCPR01MB36132CCD83A275CA4BDFAD7FE6C82SYCPR01MB3613ausp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This is a test for the html tag Kind regards, **** **** Estimating Supervisor [A close up of a sign Description automatically generated] [cid:[email protected]] ***************************** Disclaimer ***************************** The contents of this electronic message and any attachments are intended on= ly for the addressee and may contain privileged or confidential information= . They may only be used for the purposes for which they were supplied. If y= ou are not the addressee, you are notified that any transmission, distribut= ion, downloading, printing or photocopying of the contents of this message = or attachments is strictly prohibited. The privilege or confidentiality att= ached to this message and attachments is not waived, lost or destroyed by r= eason of mistaken delivery to you. If you receive this message in error ple= ase notify the sender by return e-mail or telephone. Please note: the D**** and Digital Economy and = D** carries out automatic software scanni= ng, filtering and blocking of E-mails and attachments (including emails of = a personal nature) for detection of viruses, malicious code, SPAM, executab= le programs or content it deems unacceptable. All reasonable precautions wi= ll be taken to respect the privacy of individuals in accordance with the In= formation Privacy Act 2009 (Qld). Personal information will only be used fo= r official purposes, e.g. monitoring Departmental Personnel's compliance wi= th Departmental Policies. Personal information will not be divulged or disc= losed to others, unless authorised or required by Departmental Policy and/o= r law. Thank you. _000_SYCPR01MB36132CCD83A275CA4BDFAD7FE6C82SYCPR01MB3613ausp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
This is a test for the html tag
Подробнее здесь: https://stackoverflow.com/questions/786 ... sert-mysql
Удалите заявление об отказе от ответственности и блокировку подписи из электронной почты и вставьте MySQL ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Заявление Python "Match" подчеркнуто Red в Pycharm 2020.3.5, но заявление "Match" работает
Anonymous » » в форуме Python - 0 Ответы
- 36 Просмотры
-
Последнее сообщение Anonymous
-