I am reading mails from a pop3 server with imap and decoding them with a mailparse class which uses PEAR Mimedecode.

I was wondering if there's any way to get the signature or just to remove it from the body of the mail.

Thanks.

有帮助吗?

解决方案

The signature is part of the body, so no, there isn't really a way to just remove the signature, unless you knew that every signature was going to have the exact same format.

If you knew that every signature was going to come after 10 hyphens, like this

Lorem ipsum lorem ispum.Lorem ipsum lorem ispum.Lorem ipsum lorem ispum.
Lorem ipsum lorem ispum.Lorem ipsum lorem ispum.
----------
Your Name

If that is the case, then you could just do

$message = explode('----------', $body);

Where $message[0] would be the body, and $message[1] would be the signature.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top