Results 1 to 5 of 5

Thread: Parse email contents

  1. #1
    agvg is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    16

    Default Parse email contents

    I am trying to add a new save button besides the forward button in email, to parse the mail contents and store them in database. Since i am too new to sugarcrm and php, i am not able to do so,. can anyone plz help me out how to solve this problem.Thanx in advance.

  2. #2
    Morkeleb is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    20

    Default Re: Parse email contents

    Did you ever receive assistance with this?

  3. #3
    sugarchris's Avatar
    sugarchris is offline Sugar Community Member
    Join Date
    Sep 2005
    Location
    San Francisco, CA
    Posts
    861

    Default Re: Parse email contents

    To create separate functionality, you're best off creating a new destination file, a la, Save.php.

    The button click should submit the form to that destination exactly like the Save button, but with a different action (let's call it Foo.php).

    The button would look like:
    Code:
    <input type='submit' name='fooButton' class='button'
      onclick="this.form.action.value='Foo';
      this.form.module.value='{RETURN_MODULE}';   
      this.form.record.value='{RETURN_ID}';"
    ..etc.>

    The Foo.php page should be based on something familiar. In most cases, I would recommend dissecting Save.php, but Emails' Save.php is rather complicated and messy.

    The basic premise is:
    1. take the values submitted via the form ($_REQUEST superglobal) and do some stuff with it.
    PHP Code:
    $name myCustomFunctionThatReturnsAString($_REQUEST['name']);
    $desc myEmailBodyProcessor($_REQUEST['description']); 
    2. save the stuff and redirect to the DetailView page (typical flow).
    PHP Code:
    // instantiate new Email object
    $email = new Email();
    // popuplate necessary fields after processing
    $email->name $name// processed above
    $email->description $desc// also processed above
    // save them
    $email->save();
    // redirect to the final destination page;
    header("index.php?module=Emails&action=DetailView&id={$email->id}");
    die(); 

    HTH.

  4. #4
    Morkeleb is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    20

    Default Re: Parse email contents

    agvg, do you have the code worked out for parsing the contents of the email body itself? That's what I'm currently seeking.

  5. #5
    guz843 is offline Sugar Community Member
    Join Date
    May 2005
    Posts
    171

    Default Re: Parse email contents

    Quote Originally Posted by Morkeleb
    agvg, do you have the code worked out for parsing the contents of the email body itself? That's what I'm currently seeking.
    i am willing to pay for this!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •