I just brought up an Aegir / OAb3.2 install our company hadn't used in a while, which had previously worked great w/ mailcomment. However, for some reason, notification mails are sent with some of the usual mailcomment markup (reply above this line, etc), but missing some (message ID). Because of this (I think), when I send an e-mail in reply to a notification of a new comment, I get the "Received an email with no paramters" bounce rather than posting a new comment. Notification and reply e-mail follow...

Notification e-mail:

Delivered-To: obrienmd@gmail.com
Received: by 10.229.110.13 with SMTP id l13cs78759qcp;
        Wed, 31 Mar 2010 17:42:04 -0700 (PDT)
Received: by 10.90.60.17 with SMTP id i17mr742758aga.112.1270082523544;
        Wed, 31 Mar 2010 17:42:03 -0700 (PDT)
Return-Path: <portal@praece.com>
Received: from mail.praece.com (mail.praece.com [209.147.126.117])
        by mx.google.com with ESMTP id 9si17038676gxk.1.2010.03.31.17.42.02;
        Wed, 31 Mar 2010 17:42:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of portal@praece.com designates 209.147.126.117 as permitted sender) client-ip=209.147.126.117;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of portal@praece.com designates 209.147.126.117 as permitted sender) smtp.mail=portal@praece.com
Received: from help.praece.com (209.147.126.121) by mail.praece.com
 (192.168.0.10) with Microsoft SMTP Server id 8.1.393.1; Wed, 31 Mar 2010
 17:41:09 -0700
Date: Wed, 31 Mar 2010 17:41:59 -0700
Return-Path: portal@praece.com
To: obrienmd@gmail.com
From: <portal@praece.com>
Reply-To: portal@praece.com
Subject: Re: [Praece Customer Portal] test
Message-ID: <3.868.1545.1270082519.eed8d49704e071e77f05723328073092@help.praece.com>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="b1_1f1b36a5bb24f663a2a9cf7a22c7eb0d"

--b1_1f1b36a5bb24f663a2a9cf7a22c7eb0d
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

((( Please reply ABOVE this line )))
Greetings Michael OBrien Test,
A new comment has been added to Ticket "test" by Michael OBrien:

acccccccccckkkkkkkkkkk

To learn more, you may reply to this e-mail (ABOVE the noted line), go to  
http://help.praece.com/praececonsulting/clientservice/ticket/4125284965 [1]  
or contact your Praece representative.

--
This is an automatic message from Praece Customer Portal
To manage your subscriptions, browse to  
http://help.praece.com/praececonsulting/user/51/notifications [2]
You can unsubscribe at  
http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/13...  
[3]
View original post:  
http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1...  
[4]

[1] http://help.praece.com/praececonsulting/clientservice/ticket/4125284965
[2] http://help.praece.com/praececonsulting/user/51/notifications
[3] http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/1377?signature=656a80d773d14d0412a974d516e7ed96
[4] http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1545.1270082519.caa277ceefb3a9fb5bcb0ad35da9e2be%40help.praece.com%3E

--b1_1f1b36a5bb24f663a2a9cf7a22c7eb0d
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body id="htmlmail">
 
  <div id="htmlmail-body">
  <p>((( Please reply ABOVE this line )))<br />Greetings Michael OBrien Test,<br />A new comment has been added to Ticket "test"  by Michael OBrien:</p>
<p>acccccccccckkkkkkkkkkk</p>
<p>To learn more, you may reply to this e-mail (ABOVE the noted line), go to <a href="http://help.praece.com/praececonsulting/clientservice/ticket/4125284965" title="http://help.praece.com/praececonsulting/clientservice/ticket/4125284965">http://help.praece.com/praececonsulting/clientservice/ticket/4125284965</a> or contact your Praece representative.</p>
<p>--<br />This is an automatic message from Praece Customer Portal<br />
To manage your subscriptions, browse to <a href="http://help.praece.com/praececonsulting/user/51/notifications" title="http://help.praece.com/praececonsulting/user/51/notifications">http://help.praece.com/praececonsulting/user/51/notifications</a><br />
You can unsubscribe at <a href="http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/1377?signature=656a80d773d14d0412a974d516e7ed96" title="http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/1377?signature=656a80d773d14d0412a974d516e7ed96">http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/13...</a><br /> View original post: <a href="http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1545.1270082519.caa277ceefb3a9fb5bcb0ad35da9e2be%40help.praece.com%3E" title="http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1545.1270082519.caa277ceefb3a9fb5bcb0ad35da9e2be%40help.praece.com%3E">http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1...</a></p>
  </div>
 
</body>
</html>
--b1_1f1b36a5bb24f663a2a9cf7a22c7eb0d--

Reply e-mail:

MIME-Version: 1.0
Received: by 10.229.110.13 with HTTP; Wed, 31 Mar 2010 17:53:18 -0700 (PDT)
In-Reply-To: <3.868.1545.1270082519.eed8d49704e071e77f05723328073092@help.praece.com>
References: <3.868.1545.1270082519.eed8d49704e071e77f05723328073092@help.praece.com>
Date: Wed, 31 Mar 2010 17:53:18 -0700
Delivered-To: obrienmd@gmail.com
Message-ID: <x2z2c38abbb1003311753l571109b1pc827fd24bcd7a24e@mail.gmail.com>
Subject: Re: [Praece Customer Portal] test
From: "Michael D. O'Brien" <obrienmd@gmail.com>
To: portal@praece.com
Content-Type: text/plain; charset=ISO-8859-1

OK.

Michael O'Brien
253-217-7129



On Wed, Mar 31, 2010 at 5:41 PM,  <portal@praece.com> wrote:
> ((( Please reply ABOVE this line )))
> Greetings Michael OBrien Test,
> A new comment has been added to Ticket "test" by Michael OBrien:
>
> acccccccccckkkkkkkkkkk
>
> To learn more, you may reply to this e-mail (ABOVE the noted line), go to
> http://help.praece.com/praececonsulting/clientservice/ticket/4125284965 or
> contact your Praece representative.
>
> --
> This is an automatic message from Praece Customer Portal
> To manage your subscriptions, browse to
> http://help.praece.com/praececonsulting/user/51/notifications
> You can unsubscribe at
> http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/13...
> View original post:
> http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.868.1...

Any thoughts?

Comments

obrienmd’s picture

Updated this to the latest mailcomment / mailhandler, btw. No help, the results above are from the newest -dev of both.

greggles’s picture

In my experience these are almost always "weird little things."

I suggest changing from help.example.com to support.example.com and see if that helps.

If not, try helpexample.com or some other domain that is longer than 6 characters and doesn't have a subdomain. The domain/subdomain matching is not perfect, in my experience.

obrienmd’s picture

Hah... love "weird little things"... fiddling now.

obrienmd’s picture

Nope, no dice. Any debug steps you'd recommend?

greggles’s picture

At this point I basically start putting debug statements into the code -

watchdog('obrienmd', 'currently at point X');
watchdog('obrienmd', 'variables foo is '. print_r($foo, true));

Modifying "point X" for each new place and including variables that might be useful.

obrienmd’s picture

OK, so here's the print_r($header, true) I get from the incoming e-mail (I added "watchdog('mailcomment', 'and... ' . print_r($header, true));" after the normal watchdog line for the no parameters error):

Line breaks added for readability:

stdClass Object ( 
[date] => Tue, 6 Apr 2010 09:58:55 -0700 
[Date] => Tue, 6 Apr 2010 09:58:55 -0700 
[subject] => Re: Comment for Ticket: test 
[Subject] => Re: Comment for Ticket: test 
[in_reply_to] => <3.919.1606.1270573099.c6d707f8fbdb62dcf0d39ec7e01d7910@helppraece.com> 
[message_id] => [references] => <3.919.1606.1270573099.c6d707f8fbdb62dcf0d39ec7e01d7910@helppraece.com> 
[toaddress] => Praece Client Portal 
    [to] => Array ( 
      [0] => stdClass Object ( 
        [personal] => Praece Client Portal 
        [mailbox] => portal 
        [host] => praece.com 
      ) 
    ) 
[fromaddress] => "Michael D. O'Brien" 
    [from] => Array ( 
      [0] => stdClass Object ( 
        [personal] => Michael D. O'Brien 
        [mailbox] => obrienmd 
        [host] => gmail.com 
      ) 
    ) 
[Recent] => N 
[Unseen] => 
[Flagged] => 
[Answered] => 
[Deleted] => 
[Draft] => 
[Msgno] => 2 
[MailDate] => 6-Apr-2010 09:59:15 -0700 
[Size] => 3760 
[udate] => 1270573155 
)

Looks like the messageid is in the header, and it's the same as the outgoing messageid... E-mail address is same as address for registered user w/ full commenting permissions... Any ideas? In the meantime, I'm going to keep hacking away without any skill :)

obrienmd’s picture

OK, so I traced back through some functions...

During mailcomment_authenticate_default, I pulled $node, which returns:

stdClass Object ( 
[pass] => [threading] => 3.919.1610.1270574215.7ce13d68bbb800921290199f0c95f184@helppraece.com 
[3_919_1610_1270574215_7ce13d68bbb800921290199f0c95f184@helppraece_com] => 
[type] => ticket 
[status] => 1 
[promote] => 1 
[sticky] => 
[uid] => 0 
[created] => 1270574283 
[revision] => 1 
[comment] => 2 
[menu] => Array ( 
	[link_title] => 
	[mlid] => 0 
	[plid] => 0 
	[menu_name] => primary-links 
	[weight] => 0 
	[options] => Array ( ) 
	[module] => menu 
	[expanded] => 0 
	[hidden] => 0 
	[has_children] => 0 
	[customized] => 0 
	[parent_depth_limit] => 8 ) 
[body] => ACK Michael O'Brien 253-217-7129 On Tue, Apr 6, 2010 at 10:16 AM, wrote: > ((( Please reply ABOVE this line ))) > Greetings Michael OBrien Test, > A new comment has been added to Ticket "test" by Michael OBrien: > > MOR > > To learn more, you may reply to this e-mail (ABOVE the noted line), go to > http://help.praece.com/praececonsulting/clientservice/ticket/4125216944 or > contact your Praece representative. > > -- > This is an automatic message from Praece Customer Portal > To manage your subscriptions, browse to > http://help.praece.com/praececonsulting/user/51/notifications > You can unsubscribe at > http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/14... > View original post: > http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.919.1... 
[teaser] => ACK Michael O'Brien 253-217-7129 On Tue, Apr 6, 2010 at 10:16 AM, wrote: > ((( Please reply ABOVE this line ))) > Greetings Michael OBrien Test, > A new comment has been added to Ticket "test" by Michael OBrien: > > MOR > > To learn more, you may reply to this e-mail (ABOVE the noted line), go to > http://help.praece.com/praececonsulting/clientservice/ticket/4125216944 or > contact your Praece representative. > > -- > This is an automatic message from Praece Customer Portal > To manage your subscriptions, browse to > http://help.praece.com/praececons 
[title] => Re: Comment for Ticket: test 
[changed] => 2010-04-06 10:17:32 -0700 
[date] => 2010-04-06 10:17:32 -0700 
[format] => 5 
)

The following line, "$identifier = _mailcomment_get_signature(rawurldecode($node->body));", returns nothing, as a pull of $identifier right after that line executes returns absolutely nothing... Next step is digging further into mailcomment_get_signature... Please let me know if leaving this level of detail in the issue queue is a faux pas.

obrienmd’s picture

OK, here's where I'm at: For whatever reason, notifications is not sending the e-mails with the message ID in the body, and although the reply e-mail has valid [in_reply_to] and [message_id] data in the headers, _mailcomment_get_signature looks like it is only searching for matches in the body. The next step will be searching through mailcomment's notification hooks to see why the message ID is not being added to the notification body.

greggles’s picture

obrienmd’s picture

OK, the problem looks to be that notifications or messaging is cutting off the end of the "View original post:" line, such that the message id is interrupted by ellipses. Any thoughts on why this might be happening? I'm using Messaging PHPMailer, and have been using it successfully for many months. Debugging further now...

obrienmd’s picture

This is the end of all notifications e-mails:

--
This is an automatic message from Praece Customer Portal
To manage your subscriptions, browse to http://help.praece.com/praececonsulting/user/51/notifications
You can unsubscribe at http://help.praece.com/praececonsulting/notifications/unsubscribe/sid/14...
View original post: http://help.praece.com/praececonsulting/mailcomment/redirect/%3C51.919.1...

Not exactly sure why it's getting cut off. Take a look at the issue description - the hrefs on the html "version" of the e-mail are correct, giving recipients a usable link, but mailcomment relies on the actual body text including a message ID, which is why the truncated text is causing replies to fail.

P.S. Apologies for the "blockquote", "code" tags funked up the line breaks and urls.

obrienmd’s picture

Status: Active » Closed (fixed)

My input filters seem to be configured right, but are causing an issue here... Don't think it would be a widespread problem, so I'll close this. Hacked around it for now...

Laith-1’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Closed (fixed) » Active
Issue tags: +mailcomment, +OpenAtrium

Hi All. Am re-opening this thread as it seems the best fit to an ongoing issue I have been struggling with for the past month to no avail,

Am having the same issue running Open Atrium 1.0 on Hosted Aegir.

Open Atrium ships with:
Messaging 6.x-2.4
Notifications 6.x-2.3
Content Notifications 6.x-2.3
Mailcomment 6.x-1.0

I have added and configured (with phpMailer 5.1)
PHPMailer 6.x-2.2

After setting up the feature as per instructions on the Open Atrium documentation:
https://community.openatrium.com/documentation-en/node/2286

I received the following bounce back email (xxx.xxx masked in to actual domain).

The email you sent to email@example.net was rejected because there was a validation error.

In order for emails to be accepted by example.net:
- They must be sent in reply to a valid notification email.
- The reply must be done from the same email address the notification was sent to

I have repeated the majority of these tests with both the built in Simple Mail (Drupal Mail API) and Messaging PHPMailer method with both HTML and plain text options. Same result.

Examining the message headers reveal:
- there is only one formal Message-id: <1.98.40.1312397418.4fd4af09c180d6720aa9de9d4563fce0@example.net>, typically at the top of the message.

However, there is a second id buried in the message within the Received header:
- id 1QogXf-0007XO-J5 for target@private.com; Wed, 03 Aug 2011 11:51:45 -0700

I tried commenting out the Message-id generating function in class.phpmailer.php as recommended in http://drupal.org/node/886748#comment-4334126. Same behaviour, though the Message-id now appears to be inserted by some other component (the SMTP server?) and is near the bottom of the message.

I have tried disabling input filters (Messaging Plain text). Same result.

From what I can tell, the Message-id that mail comment uses to validate/associate the email is being stripped out somewhere.

I have tried installing the -dev branch of MailComment (6.x-1.x-dev) in the modules/all, but when testing the mailcomment mail box, I get errors due to the presence of the two modules (one in the protected aegir directory that I do not have access to. The settings still work and there is no error on the retrieval of the message. Same result.

Looking for guidance on debugging this further.

Ideas/experience greatly appreciated.

Regards,

Laith

blueprint’s picture

We're experiencing the same issue with OA 1. It's difficult to determine at which stage it broke, since we've been using it since it was mail2web. Since I've followed this thread and seem to have the same symptoms, I did a simple test.

I disabled mailcomment, copied mail2web to a site instance modules folder and enabled. Checked the configuration. What do you know. It just works.

Soooo, it may be worth comparing

mail2web_mailhandler
mail2web_parse_messageparams
etc

against the new modules implementations. I'll try to get to that this weekend.

sgerbino’s picture

I'm also using OA1, my problem is when employees use Microsoft Outlook to respond. Horde webmail works, Evolution mail works, haven't tested any others.

As a debugging step, I did throw mail('my@mail.com','identifier', 'identifier' . $identifier); on the bottom of _mailcomment_get_signature() to confirm that through outlook $identifier never gets a value.

Good to know web2mail works, I'll have to take a look this weekend as well.. hopefully we can come up with some solutions on this thread.

blueprint’s picture

In our tests we used webmailers (squirrel and roundcube) and claws. So, didn't seem probable that it had anything to do with the mail app...

benjifisher’s picture

StatusFileSize
new4.14 KB

I marked #886748: Can't reply on notification mail (Validation error) as a duplicate of this issue.

I am not sure if everyone commenting on this issue has the same problem. If mailcomment is scanning the body of the e-mail, not the header, to find the "parameters," then I think I can help.

The problem is that the key line that mailcomment looks for can be broken by the mailer:

>View original post: 
>http://example.com/mailcomment/redirect/<19626.7
>877.38919.1327350009.d3a84fefbf8f95fcb3c1b2d5fa30a1a4@example.com>

Note that the Issue Summary and #7 above both truncate the key line.

Of course, how the lines are broken and quoted will depend on the e-mail client that is used to send the reply.

Please try the attached patch. If it does not help, please post here the last few lines of your e-mail, including "View original post" and "mailcomment/redirect" and what follows.

benjifisher’s picture

Status: Active » Needs review

1. I forgot to mark the issue "needs review." Please test the patch in #17.
2. Thanks to Babson College for paying me to do the work in #17.

FranCarstens’s picture

I have this issue when mail is coming from Outlook. I applied the patch in #17 which solved it.

However, part of the reply message is now left in, where previously it was filtered out.

Where is should read
Sure it does
It now reads

Sure it does

On 2/8/12 9:30 PM, "Anonymous" mail@domain.com wrote:

This only happens from the Outlook version though. From another client it works fine. Weird...

benjifisher’s picture

If the patch in #17 works for you, you can mark this issue RTBC.

The extra line is treated by the mailcomment_extras submodule. It is not surprising that it works with one e-mail client and not another, since mailcomments_extras just looks for a few particular formats. I was also testing with Outlook, so the patch in #1426358: Strip sig dashes from incoming e-mails. may help you.

narayanis’s picture

I updated MailComment and Mailhandler to the latest -dev, applied patch 17 and still got the error with Outlook.

This line of the patch:
preg_replace('/(\r\n|\r|\n)>/', '', $body);
doesn't remove line breaks due to the trailing > character, so I removed it and got a bit further.

Then I found that in mailcomment_mailhandler, $matched returns false because $to had an upper case domain name when sent from Outlook. So I added strtolower() there and in mailcomment_mailboxes(). That got it the rest of the way.

With patch #17 plus those two changes, I successfully emailed comments from Outlook! Should I roll the patch off the current -dev file that has all the changes, or apply #17 and then roll a patch off that?

danepowell’s picture

Status: Needs review » Closed (won't fix)

Sorry, Mail Comment 6.x-1.x is no longer supported. Please upgrade to 6.x-2.x and re-open if still an issue. Thanks!