質問

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