Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove Email Signature
#1
Hi,

I have this text of emails and their signature"

Quote:Good Morning

This is the first email block.


Vriendelike groete/ Kind regards

User One

Direct tel: 021 000 0000 | Email:
[email protected]






From: Test Emais [mailto:[email protected]]

Sent: 28 March 2019 11:00 AM
To: User One;[email protected];
Subject: Testing Subject




Dear Mr


Please note that we are testing this service

Service request number: TEST123 

When you contacted us: 2019-03-2810:15 AM 

Testing this

Testing it here

ok that's enough

Typing


Kind regards

The Typist


E-Mail: typist@User.co.za

Contact Number: 111 555 9988

Fax Number: 000 111 1234



The content of this email is confidential and intended for the addressee only. If it was sent to you in error, please notify the sender immediately and delete the email.

I would like to go through the text and remove the signature, but the code should be flexible for any text of this nature. As soon as there's "King Regards or Vriendelike groete" it should see that that's a signature, maybe preceded by '\n'. I don't know if there's Library out there or Regex, I've been trying to playing around with it but succeeding.

Quote:Good Morning

This is the first email block.


From: Test Emais [mailto:[email protected]]

Sent: 28 March 2019 11:00 AM
To: User One;[email protected];
Subject: Testing Subject




Dear Mr


Please note that we are testing this service

Service request number: TESTING123

When you contacted us: 2019-03-2810:15 AM 

Testing this

Testing it here

ok that's enough

Typing
Reply
#2
What have you tried so far?
Reply
#3
Hi,

Thank you for the response, I actually have a pattern already,
pattern = re.compile(r'[Kk]ind [Rr]egards|[Vv]riendelike [Gg]roete/|[Vv]riendelike [Gg]roete|[Bb]est [Rr]egards| [Bb]est [Rr]egards| [Yy]ours [Ss]incerely| \n [Rr]egards')
But it only takes out the first part of the signature

My question was more on the entire Signature, one of them include their names and numbers after 'Kind Regards':
Quote:Vriendelike groete/ Kind regards

Badu Thusong

Direct tel: 021 974 7313 | Email:
[email protected]

But others doesn't, it's just this:
Quote:Kind regards

Agriculture Contact Centre

Is there a way or methods somewhere that maybe we can even edit, that tries to identify the signature?

(Apr-25-2019, 06:17 PM)Larz60+ Wrote: What have you tried so far?
Reply
#4
Can't vouch for it, but found this package: https://github.com/mailgun/talon
Reply
#5
Mailgun's Talon library is okay. It's not super accurate.

SigParser's email parsing library is better in that it can handle multiple languages.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [cryptography.io] How to convert DER signature to ECDSA fstefanov 1 3,036 Jul-04-2019, 08:59 AM
Last Post: fstefanov
  Signature verification saisankalpj 19 8,174 Nov-22-2018, 01:55 PM
Last Post: saisankalpj
  Signature verification saisankalpj 8 5,245 Nov-20-2018, 09:32 AM
Last Post: saisankalpj
  An email with inline jpg cannot be read by all email clients fpiraneo 4 3,983 Feb-25-2018, 07:17 PM
Last Post: fpiraneo
  Email - Send email using Windows Live Mail cyberzen 2 5,918 Apr-13-2017, 03:14 AM
Last Post: cyberzen
  With Python I cannot calculate an AWS signature for Rest APIs Johno 4 6,486 Oct-06-2016, 11:05 AM
Last Post: Johno

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020