#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    78
    Rep Power
    6

    PhpBB & Mail2Forum


    Hi,
    I am using phpbb and a proggy called mail2forum which can import emails as posts when sent to a particular address. replies to same emails will be put as posts in the existing threads etc etc.

    I am trying to remove peoples email signatures from the posts as the boss doesn't want people who have left the franchise to have details posts after they have left.

    We have email sigs like :
    Name
    Company name
    Title
    m: 04401234 12
    e: emailaddress@domain.com.au
    with slight variations on which order they are listed for details.

    I want to remove the entire signature from the post.
    I thought maybe find the email address then remove 3 lines beofre and after would prolly do it.

    Trouble for me is, I cannot work out how to do it.

    I have been given help from here regarding reg exp, but it doesnt work in the mail2forum proggy.

    mail2forum has a section where you can insert reg exp, but it doesn't work with code that does actually work in a normal environment

    I have given up.

    If someone would like to work this out for me, I would be willing to pay a fee

    I can give you admin access to the bulliten board for you to work it out.
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    Sorry about that maniac who flooded this thread yesterday, he's been sacked.

    Anyway, since these lines are in no particular order and not in any given format, you might want to simply find the last blank line and delete from there to the end. Since the "sig" is normally a bunch of lines WITH content following one or more lines WITHOUT content, finding the last blank line and killing from there on is probably best.

    A regular expression would work, but exploding the message on "\n" and looping through is probably better. If you MUST use a regular expression:
    PHP Code:
    $message "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed arcu tellus. 
    Donec sit amet nisi quam, sed pretium lorem. Duis tellus nibh, suscipit id rutrum a, posuere eu urna. Ut a varius quam. 
    Curabitur neque lorem, dapibus suscipit dignissim sit amet, egestas vel ipsum. Aenean semper, dolor eu fringilla hendrerit, 
    massa nulla consequat urna, sed malesuada libero nulla non erat. Proin et nisl tortor, vel pulvinar dui. Nunc nisl nisi, 
    convallis vitae consequat ac, ornare id risus. Vestibulum tincidunt imperdiet augue, sed consectetur sem fringilla sed. 
    Cras quis suscipit tellus. In volutpat dignissim tempus.

    Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed volutpat lobortis facilisis. 
    In hac habitasse platea dictumst. Donec vulputate porttitor ante, a venenatis neque mollis non. Suspendisse potenti. 
    Donec dapibus, nulla sed mattis scelerisque, erat lorem elementum nibh, id dapibus ipsum quam eget justo. Duis rhoncus 
    pharetra felis vitae bibendum. Duis vel augue eget tortor ultricies dignissim in et turpis. Curabitur id adipiscing leo. 
    Donec ac risus in justo ullamcorper pulvinar eget quis mauris. Vestibulum id elit sit amet est cursus elementum. 
    Praesent ut augue lorem, eu ornare purus. Nunc condimentum tincidunt tellus, eu mattis orci semper sed. Mauris dui neque, 
    elementum ut rutrum vel, suscipit ac augue. Integer pretium erat eu lectus egestas adipiscing. Donec a lectus sit amet turpis mattis tempor. 

    Name
    Company name
    Title
    m: 04401234 12
    e: emailaddress@domain.com.au"
    ;

    echo 
    preg_replace("/^(.+)\n\s*\n.+$/ms""\\1"trim($message)); 
    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo