The email you sent to events@mydomain.com was rejected because there was a
validation error.

In order for emails to be accepted by website:
- 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

z.stolar’s picture

Project: Mailhandler » Mail to Web

This is a mail2web issue, not mailhandler's.
I guess it means that the email address you use to reply to a mail, must be the same as the email address the mail was sent to.

mail2web adds a special string to email notifications, and also changes the reply-to address on mails from the site. You must reply to that exact address.

z.stolar’s picture

Title: What does thsi mean? » What does the massage "The email you sent was rejected because there was a validation error" mean?

Fixing the title for findability

Ian Ward’s picture

Status: Active » Postponed (maintainer needs more info)

This means that the security signature that mail2web put in the email you received from mail2web was not found when you replied back to the email. Are you still having this problem? If so, please provide more details like what exactly you are doing, the email client you are using, etc. Thanks.

wheels394’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta3

I too am receiving this error message. I am following the documenation http://drupal.org/node/542118 and am on Optional Step 5 testing. I have sent test message from 2 vaild user emails on the drupal site. 1 @yahoo.com and 1 @gmail.com. Also changed admin email under my account of admin to work email @edc.org I have not typed anything in the mailbox configuration entry "from header".

using mailhandler 6x-1.8

wheels394’s picture

To clarify. I am not replying to any message. I am trying to post a new message. From my admin user email address.

marcrocs’s picture

@wheels394

I just spent the better part of a day messing with mail2web. It is not for posting new content on a drupal site. It is for posting comments on site content or replying to another comment via email notifications received about new content or new comments.

-----------------

What does this mean: "The email you sent to events@mydomain.com was rejected because there was a validation error."

Exactly what it says.
- Let's say uid1 posts content "the sky is falling".
- uid2 posts a comment to "the sky is falling" of "what are you Chicken Little?"
- uid1 gets a notification of new comment by uid2 and instead of having to log into the site to reply, uid1 replies to the email
- but uid1 screws up or his email app screws up and erases the validation (message id at bottom of email) or has emails forwarded to another address and attempts to reply from there.... mail2web needs to see the validation id and mail2web only let's in emails from registered users to block spam... if either one of these 2 things are missing mail2web spits back the validation error.
- Since the module is still beta and email apps having a ton of different ways of replying to stuff this module as is won't work for every user.

Ian Ward’s picture

This is correct, mail2web is for replying to notifications generated by messaging/notifications when new nodes are posted. When you reply to the notification, your reply will be posted as a comment. Mail2web is not for posting new nodes. However, you can still post new nodes. What you need to do is go to /admin/messaging/mail2web and where it says "Passthru to mailhandler module:" set this to "On". If any mail is sent to Drupal using the mail2web mailbox, and it has no headers, it will not throw an error w/ this enabled, but instead pass the mail to mailhandler for processing.

Ian Ward’s picture

Issue tags: +FAQ

@wheels394 please close this if it answers your question. I am going to tag this post FAQ and will add this question to a FAQ I will develop. Thanks

ashledombos’s picture

Thanks it helped me !

Ian Ward’s picture

Project: Mail to Web » Mail Comment
Version: 6.x-1.0-beta3 » 6.x-1.0-beta4

Switch to mailcomment project. Mail2web is now known as "mailcomment" due to a trademark issue with the name mail2web.

greggles’s picture

toddwoof’s picture

I'm having the same problem, after upgrading from the old Mail2Web version to MailComment:

When I receive an email notification for a Forum post and reply to it, the email is rejected with the "validation error" message. I've checked through all the settings for mailcomment, mailhandler, and notifications, and it all appears to be correct. I'm not forwarding emails, or anything like that. Same email account as I was using prior to the upgrade to 6.x-1.0.

I also tried the dev version.

Any suggestions?

vhenninot’s picture

Hello,

Everything worked well until i update mailhandler... (to 6x 1.10)

Since that, mail comment is unable to recognise correct answers... every mails are rejected with the "The email you sent to XXX was rejected because there was a validation error."

Is there anything to do ?
Is mailcomment will work again with last mailhandler version ?

Thanks for any help,
Vincent

greggles’s picture

@vhenninot - I suggest the latest dev of Mailhandler as a first step. I'm using that on a site where it continues to work.

Note also that the configuration of the two modules has changed a lot recently. Be sure to visit the configuration pages and review the new options.

toddwoof’s picture

@greggles: Thanks -- I tried that, but no change. Basically, if forum replies are posted on the site, it works: They are shown in the list of replies on the site, and the emails are sent to the recipient list. But incoming email responses are rejected.

I've been through the config pages (probably too many times...) and can't find anything wrong. The email box is right (it says it can connect properly); the from user is right, etc. Any other suggestions?

Here are my settings:

Mailhandler:
* Forum topic = default content type.
* Cron retrieval = 0.
* Default character encoding = UTF-8

Mailcomment:
* Master mailbox and MailComment-enabled mailboxes and catchall = all set to the same mailbox, the same as before (the only choice, since we only set up one).
* Expiration time = never.
* Insert reply: checked or unchecked, it doesn't do anything (I have the reply text in the template).
* Bounce rejects = checked.
* Server string = our domain without www.
* Use Mailing list-style subjects = off
* Enable message cleaner = off
* Mail comment content types = Forum topic and Announcements (organic group posts)
* Passthru to mailhandler = off (but I tried all the permutations, on and off, with each of the Use default mailhandler authentication... options).

Thanks!

greggles’s picture

I think you need Passthru to mailhandler on if you want a new mail to get accepted. You may also want to try Mailcomment 6.x-1.x-dev.

toddwoof’s picture

To clarify:

* I am running the dev version, as you suggested.
* I tried all combinations of Passthru Mail Handler: On, Off, and with each of the two sub-choices selected.

Anything else? Thanks!

toddwoof’s picture

I would be interested in "how to" notes, if anyone has gotten this to work in an environment with og forums. For now I've reverted to Mail2Web.

Ki’s picture

Version: 6.x-1.0-beta4 » 6.x-1.0

In my case, the regular expression in function _mailcomment_get_signature() was not set right to recognize the message id.

// Line 567 in mailcomment.module
// Before:
if (preg_match("/([0-9]+\.){4}+[a-z0-9]+@([a-z0-9])([-a-z0-9_])+([a-z0-9])(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*/i", $body, $matches))

// After: just dropped extra ([a-z0-9])
if (preg_match("/([0-9]+\.){4}+[a-z0-9]+@([a-z0-9])([-a-z0-9_])+(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*/i", $body, $matches))

After changing the regex, it finally worked for me after hours of struggle. I am no regex expert, so somebody could refine it.

With this regex issue, I wonder how many people are successfully using mail comment module at all.

greggles’s picture

Status: Postponed (maintainer needs more info) » Active

It's basically saying "2 letters in the domain, or 3 letters" - plenty of people have 3 letter domains. I think this change makes sense, though others should note that it is only one of many possible reasons that you could get this error message.

jasonwhat’s picture

I'm having this also and it looks like my message id is all garbled because of a formatting issue in the outgoing email. I used "messaging plain text" as my input filter when sending, but nothing changed so my message id looks like this:

MessageID=<a href="mailto:109.115.16.1275922582.a8e5e74f40c4565a2dabeeaacfbf4774@example.com">&#49;&#48;&#x39;&#x2e;&#49;&#49;5&#x2e;&#x31;&#54;&#46;1&#x32;&#x37;&#53;&#57;&#x32;&#x32;&#53;&#56;&#50;&#x2e;&#x61;&#56;&#101;5&#x65;&#x37;&#52;&#102;4&#x30;&#x63;&#52;&#53;&#x36;&#x35;&#97;&#50;&#100;&#x61;&#x62;&#101;&#101;a&#x61;&#x63;&#102;&#98;f&#x34;&#x37;&#55;&#52;&#x40;&#x65;&#x78;&#97;&#109;&#x70;&#x6c;&#101;&#46;c&#x6f;&#x6d;</a></p>
rimu’s picture

#20: I found that both of these regular expressions were causing me problems on my web site, which uses cc3.dev.mydomain.org.nz - $matches[0] was getting cut off to be just 396.3148.0.1276561076.26fb0b166ad7ef5fb5fd6621b42ddbe3@cc3.dev.mydomain.org with no .nz on the end.

Subsequently mail comment was rejecting all emails because they appeared to be coming from the wrong web site...

Ideally the regular expression should work with any amount of sub-sub-sub domains. Sorry, I don't know regex well enough to suggest a better one!

Ian Ward’s picture

Title: What does the massage "The email you sent was rejected because there was a validation error" mean? » Regex for signature lookup needs work
Category: support » bug

Changing to bug report, updating title.

chrisshattuck’s picture

Category: bug » support

I ran into an issue with the regular expression as well, and made some changes to the _mailcomment_get_signature. Mainly, I:

  • Added the server string as part of the regex, instead of doing a check for it after finding a match. This allows the regex to be simpler, a few lines of code to be removed, and in my case actually work.
  • Added the s modifier to ignore new lines in the match (Ian mentioned this was a weakness of the current regex)

Here's the new function. I'm pretty new to the module, so I wanted to run it by folks before whipping up a patch:

function _mailcomment_get_signature($body) {
  // Grab the server string and make it regex-friendly
  $server = str_replace('.', '\.', variable_get('mailcomment_server_string', 'example.com'));
  // Check for a signature match
  if (preg_match("/([0-9]+\.){4}[a-z0-9]+@" . $server . "/is", $body, $matches)) {
    // We have a match for the messageid and the mailcomment domain string so we are good
    return $matches[0];
  }
  // No matches found so assume we have no messageid and node->threading is not set
  return FALSE;
}

Here's the current code for reference:

function _mailcomment_get_signature($body) {
  if (preg_match("/([0-9]+\.){4}+[a-z0-9]+@([a-z0-9])([-a-z0-9_])+([a-z0-9])(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*/i", $body, $matches)) {
    //  Check to make sure the match has our mailcomment domain
    $domain = variable_get('mailcomment_server_string', 'example.com');
    if (strpos($matches[0], $domain)) {
      $signature = $matches[0];
      // We have a match for the messageid and the mailcomment domain string so we are good
      return $signature;
    }
  }
  else {
    // No matches found so assume we have no messageid and node->threading is not set
    return FALSE;
  }
}
greggles’s picture

Category: support » bug

Seems reasonable to me. Hopefully it will be more resilient and faster. Fixing cross-post on the category as well. Seems like this is a bug.

obrienmd’s picture

New function works great here (ie I can't perceive any difference). Will see if the new-line solution solves http://drupal.org/node/869742 (I suspected something like this may have been the issue).

HeWhoWalks’s picture

Status: Active » Needs review
FileSize
1.57 KB

@chrisshattuck code looks good. More efficient than original code. Tested and works fine on my site (original code doesn't as I have a 2-letter TLD). I've created a patch using your code as a base - anyone else able to give it a test?

obrienmd’s picture

Status: Needs review » Reviewed & tested by the community

@HeWhoWalks Quick test to/from a couple different mail client / server types seems to validate your patch. Greggles or Ian - thoughts on integrating this method into mailcomment 6.x-1.x and 2.x branches?

Ian Ward’s picture

I agree this is rtbc and should go into 1.x and 2.x. I may not get around to the queue myself until next week sometime.

obrienmd’s picture

Ian - Any way you could commit this to -dev soon? Sorry to push :)

Ian Ward’s picture

Status: Reviewed & tested by the community » Fixed

This is committed to 1 and 2. Thanks everyone.

obrienmd’s picture

Thanks much, Ian!

lukus’s picture

Hi

Thanks so much for this fix .. have a domain with a two char extension, and it works (nearly) perfectly for me.

The only problem , is that I'm receiving a PHP warning error. I'm running PHP 5.2.13.

Warning: Call-time pass-by-reference has been deprecated in /var/aegir/platforms/atrium-1-0-beta8/profiles/openatrium/modules/contrib/mailcomment/mailcomment.module on line 402

Line 402 is

_mailsave_save_files(&$node);

From what I gather, this uses an old style of referencing -> (info garnered from http://drupal.org/node/508320#comment-1803716)

So... I took out the '&' and all's well.

Cheers

Luke

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rfreij’s picture

While testing, i make a comment in a notebook page in the browser and then i set myself to notify. Then i reply to the notification and it posts back into OA. So it actually works great, but now i am getting another email with blank fields as below:

((( Reply ABOVE this LINE to POST a COMMENT )))
Greetings [user],
Comment by [comment-author-name]: [comment-title]
[comment-body]
Read more [comment-url]

--
This is an automatic message from [site-name]
To manage your subscriptions, browse to [subscriptions-manage]
You can unsubscribe at [unsubscribe-url]

any thoughts?

S.Siva’s picture

Title: Regex for signature lookup needs work » mail handler throws error
Priority: Normal » Critical
Status: Closed (fixed) » Active
FileSize
65.74 KB
80.32 KB
46.28 KB
80.81 KB
80.22 KB

Hi i am S.Siva, i am using mail handler to reply to forum, i followed this document http://drupal.org/node/542118#testmailhandler. i have also attached the screen shot what i have done till now, i don't know where i have done a mistake , my site admin email id and mailhandler 's mailbox id 's are same. but when i reply to the email it is throwing the error. pleas help me to fix it.

ejatkins’s picture

ramsey,
did you find a solution to your problem?
I am having the same problem and can not find much info on it.

S.Siva’s picture

Priority: Critical » Normal
Status: Active » Fixed

Hi Firends, Thanks for your advice, issue fixed, i installed i map in my server and then configured the mail settings properly, then certificate as /ssl. it worked fine.

squinternata’s picture

i m having the same problem could you help me?
when i reply trough my email i receive the same error.
i m using
mailcomment 6.x-1.0
Mailhandler 6.x-1.11
Notifications 6.x-2.3
pleasee
thanks

rfreij’s picture

Still no solution....sorry for the late response.

Status: Fixed » Closed (fixed)
Issue tags: -FAQ

Automatically closed -- issue fixed for 2 weeks with no activity.