Need help configuring forum's "Reply to post" feature.

Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Número de respuestas: 47
Imagen de Particularly helpful Moodlers Imagen de Testers

I am wanting to try to configure my moodle so that it supports the new "Reply to Post via Email" feature.  I have read the docs, but they seem a little vague.  Could someone provide some step-by-step instructions, and an example, of all of the settings that need to be configured to make this work?

I know that here on Moodle.org, this feature is working.  Maybe someone could share all of the settings that have been used right here.

Or is there a YouTube video showing how to configure this feature?

Part of what I have found is "If the administrator has checked the " Always send email from the no-reply address" option in "Site administration>Plugins>Message outputs>Email", has activated the settings in Site administration>Server>Incoming mail configuration>Mail settings and Message handlers then you can reply to a forum post once it has arrived in your email inbox."  However, this lacks the specific details.

Thanks.

Promedio de valuaciones (ratings): -
En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Rick,

Apologies - I thought that the documentation for this had been finished and added to the Moodle docs, but I'm unable to find it. I'll ensure that they're added as soon as possible.

For the moment I'll quickly describe what you need to set and then I'll turn these notes into proper documentation.

For the Reply to post feature to work, you need a dedicated IMAP account. This account should not be used by anyone else. It should not be a personal account, or one which is automatically checked by another client (e.g. Outlook). When the task runs to fetch messages from the IAP account, it makes changes to messages in the account, and the account structure (it reads all of your mail, flags it, and moves some of it to other folders).

You will need the following information to hand:

Inbound address (i.e. the bit before the @ sign when you send this account mail. In the address moodle@example.com, that would be moodle);Inbound domain (i.e. the bit after the @ sign when you send this account mail. In the address moodle@examplec.om, that would be example.com).IMAP server (e.g. imap.gmail.com);IMAP username (the one you would use to log in to check mail manually); and IMAP password (the one you would use to log in to check mail manually).


You may additionally need to know what security settings your IMAP server uses but either of Automatically detected SSL, or Off are the best settings to use.

After logging in as an administrator, navigate to Site administration -> Server -> Incoming mail configuration -> Mail settings and enter the above details. You will also need to tick the "Enable incoming mail processing" setting at the top of the page.

Now open the "Message handlers" page from the same part of the administration tree. You can select which features you enable and configure any default options for them. For "Reply to post", you need to edit the "Reply to forum posts" handler. Here is an example of a filled-in settings page.

Message validity for the forum defaults to one week, but you can configure it. After this time, the handler will reject the message, the argument being that, with a week old message, you may want the user to view the message on the forum to ensure that there haven't been subsequent replies that they have missed, etc. and which may be relevant.

It's up to you whether you require validation of the sender's e-mail address. This ties in with one of the other handlers (Invalid recipient handler). Essentially this means that if a user does not use the e-mail address in the user's profile, then Moodle will send an e-mail to their profile address asking them to confirm the message. If the Invalid recipient handler is disabled, then the message will be rejected. If you don't wish to have this additional level of checking, theny you can disable the check entirely for the reply to post handler.

The only other part of the setup is to ensure that you have cron configured to run regularly.


Hope that this helps,

Andrew

Promedio de valuaciones (ratings):Useful (4)
En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Mary Cooch (personal account) -
Imagen de Documentation writers Imagen de Testers

Here is the current documentation which all are welcome to improve: Incoming mail configuration

Promedio de valuaciones (ratings):Useful (1)
En respuesta a Mary Cooch (personal account)

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Thanks Mary and Andrew,

I am determined to get this feature working.  I will be working on this over the next several days, so you will probably see some more of my posts asking more questions.  For now, you have helped and I am going to study the materials again and experiment.


En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

I think that I have made most of the edits to settings, but it is not quite working.

Where is it that tells moodle to create the reply address as something like "posts+AAAAAAAAAAIAAAAAAAfzBQAAAAAAEjLjY+Hha9nStJ6NLo3h@moodle.org"?

I have set: Plugins| Message outputs | Email,  Always send email from the no-reply address, and I erased what I had in the "no-reply filed?"  But must the no-reply field contain something like "posts+???+@mydomain.com"?

I am also not sure if I "must" enter other things onto this Email settings page.

Andrew, in your link to an example, your settings show "Server Type", and you have set this to "IMAP".  My moodle doesn't have this setting.  I am using Moodle 2.8.1+ (Build: 20141218).


En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Mary Cooch (personal account) -
Imagen de Documentation writers Imagen de Testers

Rick - if you mean the screenshots Andrew posted above and you are referring to "server type" there, it's possible that screenshot was from an earlier version of the feature, because I don't see it in the 2.8 standard Moodle page now.

En respuesta a Mary Cooch (personal account)

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Yep, that's what I thought it might be.

I still need help figuring out what goes into the "no reply" textbox.  It has to be some form of "post" + "wildcard, or internal variable".  I am sure someone will know how moodle.org has this set.  It seems to be part of a missing puzzle.

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Rick,

That is set automatically after following the above instructions.

With e-mail there are quite a few address-type fields in the envelope. The field that we use for forums is one called the "Reply-to" field. This is different to the "Sender", and the "From" (though I always get those two confused).

When Moodle sends a forum message, and you have Message Inbound enabled, and you have the Forum Handler enabled, then it will place the special address with all of that metadata gunk in the Reply-To address. The other fields will remain unchanged.

Most mail clients will not display this data at all until you hit reply.

There is a caveat whereby GMail (and possibly others) make things slightly harder. If you are replying to a message which you yourself originally sent from an address that you have verified as being yours, Google will ignore the Reply-To field. However, you can view this by clicking the downwards triangle next to the recipient name on the left.

Andrew 

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Andrew, you mention to have "Forum Handler" set as enabled.  Where do I set this?

What I am noticing is that I am seeing a Reply-to field, but this contains my own email address.

I will attach a screenshot of how emails from moodle.org appears in my email client, and how my own appear.  

I am also attaching my settings in "Message handlers".


Anexo Moodle-forum.jpg
Anexo moodle2.jpg
En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Mary Cooch (personal account) -
Imagen de Documentation writers Imagen de Testers

Rick - I think by "forum handler enabled" it  means - go to Site admin>Server>Incoming mail configuration>Message handlers and make sure the one that says Reply to forum posts says Yes and not No

I will leave the rest to Andrewsonrisa

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Rick,

That does look correct - the was the setting that I was referring to (and the dropdown).

I wonder whether your host is filtering out the Reply-To header at some point. If you are able to enable to the debugsmtp setting in Moodle, for a few minutes and run the cron task, I believe it will tell you what reply-to address it is using (if one is being used at all that is). If Moodle is sending the mail with the Reply-To address, but you are not receiving it that way, then the mail server you are using may be filtering out the header.

Andrew

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Hi Andrew,

I am not sure what happened, but as I was creating some forums for several courses that I want to turn on tomorrow, and creating a topic, when my Moodle emailed these out the Reply-To had the right format.  Wow!  I am not sure why.  I wonder if it has something to do with the rating date being entered, or something like that.

Now, my problem is that any reply gets immediate kicked back by my server.  I have tried using a variety of forms of the incoming sever, including mail.rjerz.com:110, mail.rjerz.com:143, mail.rjerz.com:993, mail.rjerz.com:995, and mail.rjerz.com (no modifier).  

Might there be something in my mail server (Exim) that needs configuration?  Any ideas?

Here is the message that is coming back from my server:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

moodlef+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAHvs+HJTFOyFHRiR7fwM@rjerz.com
   No Such User Here

------ This is a copy of the message, including all the headers. ------

Return-path: <rick@rjerz.com>
Received: from 173-20-80-89.client.mchsi.com ([173.20.80.89]:35432 helo=[10.0.1.15])
by ip-192-169-227-105.secureserver.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
(Exim 4.84)
(envelope-from <rick@rjerz.com>)
id 1Y8JhX-0001vm-KH
for moodlef+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAHvs+HJTFOyFHRiR7fwM@rjerz.com; Mon, 05 Jan 2015 20:16:55 -0600
Content-Type: multipart/alternative; boundary="Apple-Mail=_4044A79B-4193-463A-8723-B3BE16E1497A"
Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
Subject: Re: MSCI3005-S15: Click here to introduce yourself. Then click on "Reply."
From: Rick Jerz <rick@rjerz.com>
X-Priority: 3
In-Reply-To: <825A8CF3-6941-424B-8297-544474D25B50@rjerz.com>
Date: Mon, 5 Jan 2015 20:16:55 -0600
Message-Id: <C0B9DC8C-6AA9-434B-90AB-93E7A344A1C5@rjerz.com>
References: <d2c63e0a474419311be8ff6c8fcdcee671770a191204597e475a412a085d3bd6@www.rjerz.com> <825A8CF3-6941-424B-8297-544474D25B50@rjerz.com>
To: moodlef+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAHvs+HJTFOyFHRiR7fwM@rjerz.com
X-Mailer: Apple Mail (2.1993)


--Apple-Mail=_4044A79B-4193-463A-8723-B3BE16E1497A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Matteo Scaramuccia -

Hi Rick,
yes, it could be an issue with your current Exim configuration not being actually able to use the aliasing via plus e.g. https://www.digitalocean.com/community/questions/exim4-dynamic-plus-addressing.

HTH,
Matteo

Promedio de valuaciones (ratings):Useful (1)
En respuesta a Matteo Scaramuccia

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Matteo, you might be on to something.  Thanks.  I started checking around, and I really couldn't find enough information about making these changes to give me confidence that I will not "break" something.  In the link that you provided, it suggests simply adding a few lines of code to the exam.conf file.  However, I could find any additional documentation about this that made me feel comfortable.  I might have to wait until I get another experimental server.  I am not an expert on email configuration.

This suggestion (from the link you posted) looks simple, but will it really work?  Can I damage anything? Some information that I found talked about other configuration files.

I've been told I need to insert this in exim.conf:

local_part_suffix = +*
local_part_suffix_optional


En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Rick,

Without knowing more specifics of your configuration, it's difficult to know exactly what to advise here. This is the correct option to apply in your router configuration (see http://www.exim.org/exim-html-current/doc/html/spec_html/ch-generic_options_for_routers.html for a bit more information on it).

Essentially it is telling exim that +* is an acceptable suffix to a valid local_part. The local_part is the mailbox that the message would be delivered to, so by saying that there is an optional suffix of +*, you're saying accept mail to the local_part 'posts', and 'posts+*'. The * is a wildcard, so essentially anything to 'posts+anything@mydomain.com' will be delivered to the posts mailbox. That's exactly what we want.

On the whole, this should *not* be a dangerous addition if applied correctly - I assume that you don't already have an existing local_part_suffix set for the relevant router, in which case it should just be a case of adding the above to that router. If you do have an existing local_part_suffix specified, then you will need to turn them into a list (separate the values with a colon). As long as you specify the _optional setting too, this should not be dangerous.

Hope this helps,

Andrew

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Tim Hunt -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers

Andrew, if this was your server, how would you go about diagnosing it?

Can you turn the steps you would follow into a useful set of instructions that a less experience admin could follow on their own server?

En respuesta a Tim Hunt

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

I would like it to be as simple as adding to exim.conf:

local_part_suffix = +*
local_part_suffix_optional

However, I am going to have to wait until I get another experimental server to try this.  Right now, I only have my "production" server.

En respuesta a Tim Hunt

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Tim,

It's very difficult to do so because it depends upon so many factors:

  • Linux / Solaris / BSD / other?
  • Flavour/Distribution of that OS
  • Version of that distribution
  • Version of exim

I work primarily with Debian, and sometimes with Ubuntu. I have experience with Solaris too, but I repress that memory as best I can. I also have a little experience with RedHat and CentOS.

Since all of these do vastly different things with configuration, these are the things that we need to know first. It's also useful to know the level of background knowledge and how comfortable someone is with the CLI. I work almost solely in the CLI - I don't have any of the Linux GUI tools installed (e.g. network manager). For me to explain how to edit a config file and restart the service using a RedHat GUI tool would be next to impossible.

Essentially though, in this instance, Rick needs to take a look at the Exim configuration handling his Moodle incoming mail, and find the router which handles delivery to mailboxes. Since mail server configurations vary so much from installation-to-installation, that becomes really rather tricky.

With regards diagnosing where these changes need to be made though, I'd:

  1. start with a shell on the server and use the exim -bt command to determine how the message woudl be routed within the server itself (e.g. exim -bt posts@mydomain.com); that will tell me which router(s), and transport are used;
  2. I'd then see how it behaves with an address with a sub-account (e.g. exim -bt posts+foo@mydomain.com);
  3. I'd have a go at making any relevant changes to the config file (without restarting exim); and test the config file parses (exim -bV) and repeat the exim -bt commands; and
  4. if all is good, I'd restart exim with the new configuration.

See https://github.com/Exim/exim/wiki/TestingExim for some more tips.

Sorry that I can't be more specific about things,

Andrew

Promedio de valuaciones (ratings):Useful (2)
En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Carlos Kiyan Tsunami -
Imagen de Plugin developers

hello Andrew 

we are trying to set the reply to post forum. but unfortunately we got this message

Connecting to imap.gmail.com:993 as m28itm..

our Windows Server 2008 R2 x64 edition is installed in WMware. It has apache 2.4, MySQL 5.5 and  php 5.5.15.  The imap dll at php.ini has been enable.  We have created a gmail account. 

According with several sites our port 993 is closed.  Testing the imap gmail configuration with Pegasus Mail client using the port 993 is possible to retrieve the emails from that gmail account inside the same server.

We have tested the same gmail imap settings with external moodle server  works. 

What should i do?

Thanks in advance

Carlos

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Andréa Oliveira -

Hi Andrew,


Please, help-me!!

The messages are arriving via regular mail, but students can not answer the e-mail itself. I followed all your instructions given above and're only missing to complete it. Can you help me, please!

below'm sending you an e-mail body image (the student of the email is gmail).


image test

Ps: this option: reply to email , (Appears more when I click is disabled. Has no link)

Thanks!!

En respuesta a Andréa Oliveira

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Andréa,

It looks like the translation for that string is out-of-date. We took the e-mail address out of that string so that it now reads "You can reply to this forum post by email." (in English).

If you click on the arrow next to "para mim" in your screenshot, what does it show?

Note: GMail doesn't use the reply-to address if the reply-to address is one of your known aliases.

Hope this helps,

Andrew

Promedio de valuaciones (ratings):Useful (1)
En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Andréa Oliveira -

Andrew,

I managed to solve the problem through a simple configuration in admnistrative panel from my server. Now everything is running smoothly according to the specifications of this new modality forum.

The teacher Eduardo Karus (https://moodle.org/mod/forum/discuss.php?d=277532#p1194448) gave me a tip, and I think that will help the fellow up there.

I did not have to contact the administrator to change the exim.conf.


Ps: I hope I can help someone


Thank you

En respuesta a Andréa Oliveira

Re: Need help configuring forum's "Reply to post" feature.

por Rick Jerz -
Imagen de Particularly helpful Moodlers Imagen de Testers

Was it "creating a catch-all" from this tip that helped you?

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Francis Vendrell -

Hello


I had the same problem and solved it quite easily. Go to your email administration panel and change the following parameter from "Reject" to "Forward to address..."

What to do with mail sent to nonexistent users

Bounce with message
--> Forward to address: forum@example.com
Reject

I hope this may help.... Thank you Andréa for your help!

sonrisa
En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Mukarram Syed -

I desperately need help with this feature. 

Here is my current situation:

  • Running Ubuntu 14.04, apache, using postfix to send emails
  • Latest Moodle 2.8.3+
  • Setup all the configurations required for incoming email (Used gmail IMAP)
  • Private file area working fine without any issues. 
  • Forum email notifications just don't seem to work at all. No matter what I do, the emails don't have a reply-to in the headers. I have checked to see if the server is stripping it by stopping the postfix queue and the original headers don't contain the reply-to email address. 
  • Followed all suggestions here, added a catchall setting for postfix. No go.


I am just receiving emails with the no-reply email address I had defined in the setting site-administration->plugins->message-output->email. There is no reply to email in the header even when seeing the original source from the gmail or outlook interface. I have also enable "Always send email from the no-reply address?"

What am I missing here???


En respuesta a Mukarram Syed

Re: Need help configuring forum's "Reply to post" feature.

por Andréa Oliveira -

You are configuring with encryption or no encryption?


En respuesta a Andréa Oliveira

Re: Need help configuring forum's "Reply to post" feature.

por Mukarram Syed -

UPDATE: After a bit of reviewing the code in /mod/forum/lib.php and testing stuff out, I have a few findings below:

Question for Andrew: Why did we move the reply-to email variable at the bottom of email body and not in the email header in the file /mod/forum/lib.php?

After spending 6 hours of troubleshooting time, I just couldn't figure out why the reply-to email was not coming through. 

I did a couple of things:

Hardcoded $replyaddress variable on line: https://github.com/moodle/moodle/blob/MOODLE_28_STABLE/mod/forum/lib.php#L762  It seemed to work. I added a dummy plus address format email and it seems to work fine too. The reply to was coming through in the notifications.  But the moment I remove the hard-coded email, the reply-to is complete missing in the notifications. 

Then after a bit of research and according to some specs online, the reply-to should be present in the header. 

I added this line: $userfrom->customheaders[] = 'Reply-To: ' . $replyaddress; (immediately after line 763) and it all seems to work just fine! The reply-to is coming through the way it is supposed to. The reply by email is working. The posts are being posted correclty.(Tested using 4 different users and 4 different email addresses by different providers).

I wonder why this is happening and what could be the reason behind this bizarre issue. Is it postfix? Do I need to configure it to pickup reply-to from the body of the email since its not within the header? Remember, Postfix is what is sending these emails. I have gmail configured for IMAP in Incoming Mail Configuration. 

HELP! Even though what I did works perfectly for me, I don't want to modify the core code?

Kind Regards,

Mukarram

En respuesta a Mukarram Syed

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Mukarram,

Firstly my apologies for the delay in my reply. I had written a reply yesterday morning, but inadvertently lost it, and I haven't had a chance to re-write because of weekly integration.

So first things first, the replyto variable in the body is no longer used. It was originally used, but moved recently in MDL-48212. The replyto variable is passed to the message headers by way of the eventdata.

By passing this into the eventdata, it makes it's way to:

  1. lib/messagelib.php, where it is passed to:
  2. send_message and then to:
  3. \core\message\manager::send_message where it is passed to:
  4. anager::send_message_to_processors where it is passed to each message output processor, including:
  5. email where the variable is:
  6. picked up and then passed to:
  7. email_to_user: where it's eventually:
  8. added to the headers.

So with this information in mind, the first thing to check is whether the replyaddress variable is actually set. We can do this by adding some debugging to find out whether our $replyaddress variable was set by adding the following debugging just just after replyaddress is first set:

    if ($userto->canpost[$discussion->id] && array_key_exists($post->id, $messageinboundhandlers)) {
        $messageinboundgenerator->set_data($post->id, $messageinboundhandlers[$post->id]);
        $replyaddress = $messageinboundgenerator->generate($userto->id);
    }

mtrace("Setting the reply address for {$userto->id} / {$post->id} to {$replyaddress}");
var_dump($replyaddress);

    $a = new stdClass();

If this reply address is not set, then we can add further debugging to the point at which the data key is generated:

    // Save the Inbound Message datakey here to reduce DB queries later.
    $messageinboundgenerator->set_data($pid);
    $messageinboundhandlers[$pid] = $messageinboundgenerator->fetch_data_key();

mtrace("Setting the data key for post {$pid} to {$messageinboundgenerator[$pid]}");

    // Caching subscribed users of each forum.

If this is not set, then we'll need to dig deeper into the data key generation to work out why it's not and which condition has not been met.

If both of these are set, then we'll need to take things through the above logic all the way to where the headers are actually applied in lib/moodlelib.php.

One place that things could be going wrong (though it is unlikely) is in the character encoding phase of email_to_user.

If you could have a look at the above, it may help track things down.

Cheers,

Andrew

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Mukarram Syed -

Hi Andrew,

Thanks a ton for your detailed reply. 

I had done debugging for step 1:

  1. The replyaddress is not being generated; and/or 

The replyaddress is being generated and is printed out in the cron job, when I do vardump for this variable.


Looks like there is an issues somewhere here:

By passing this into the eventdata, it makes it's way to:

  1. lib/messagelib.php, where it is passed to:
  2. send_message and then to:
  3. \core\message\manager::send_message where it is passed to:
  4. anager::send_message_to_processors where it is passed to each message output processor, including:
  5. email where the variable is:
  6. picked up and then passed to:
  7. email_to_user: where it's eventually:
  8. added to the headers.


Remember, If I set the reply-to address to the $userfrom->customheaders[], everything works. Somehow, the replytoaddress from $eventdata is not being added to the header by the Message API.


I am going to debug this over the weekend with the steps you mentioned and post my findings on here.


Just a quick recap: I have not done any core modification, no plugins are activated currently, clean upgrade from 2.7.5 to 2.8.3, ubuntu 14.04, apache2, postfix for mails.


Kind Regards,

Syed




En respuesta a Mukarram Syed

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

I'd recommend starting by var_dumping the $replyto variable just before it's passed to email_to_user() at https://github.com/moodle/moodle/blob/v2.8.3/message/output/email/message_output_email.php#L95.

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Miguel Da Silva -

Hej hej, I've done this and the variable $replyto is set correctly. I
added the lines below just after the "}" character at line 94 of
message/output/email/message_output_email.php and then executed cron
manually.

mtrace("replyto - message/output/email/message_output_email.php -
{$replyto}");
var_dump($replyto);
The output is just like what I was expecting:

replyto - message/output/email/message_output_email.php -
moodleuser+AAAAAAAAAAIAAAAAAAAlewAAAAAAAmuHmgUDHHinY952DegC@domain.com
string(79)
"moodleuser+AAAAAAAAAAIAAAAAAAAlewAAAAAAAmuHmgUDHHinY952DegC@domain.com"

Moodle is configured such that the IMAP account is
moodleuser@domain.com, that's why "moodleuser" appears on the
messages. Nevertheless, the only way to get the feature working is
doing the same thing Mukarram Syed did, i.e., adding the follwoing
line to mod/forum/lib.php:

$userfrom->customheaders[] = 'Reply-To: ' . $replyaddress;
On the other hand, I'm checking the Message API code to be sure whether
the following statement actually makes Moodle add the "Reply-To"
string to the mail header (such statement goes here in the code
https://github.com/moodle/moodle/blob/v2.8.3/mod/forum/lib.php#L788):

$eventdata->replyto             = $replyaddress;
I'll be sending some news soon.

Greetings.

En respuesta a Miguel Da Silva

Re: Need help configuring forum's "Reply to post" feature.

por Miguel Da Silva -

So, after doing some work related to debugging this issue I got some novelties. It seems to be the fuction validateAddress() is getting tricked when it's going to validate an address generated in order to handle answers from e-mail clients.

The following two addresses was generated by Moodle and validateAddress() returned false:

moodlereceiveduser+AAAAAAAAAAIAAAAAAAA3UgAAAAAAAmuTC2W9OVpmOlmIEH/I@domain.com
moodlereceiveduser+AAAAAAAAAAIAAAAAAAAlewAAAAAAAmuTUOkwZ9YI2PtfxWOj@domain.com

I changed them in order to post this message, but I guess it is enough to give an example of addresses involved in this issue; moodlereceiveduser is the IMAP user in the local domain running the site.

Well, tracking it down a little bit made me check some code in lib/moodlelib.php; here is where the "Reply-To" header option is to be included in the outgoing message. In this section of the code the function addReplyTo() will be called and its jobs is to invoke addAnAddress() in a proper way.

The later one is responsible to execute validateAddress() and then problems arise. triste

Soon, more news...

Greetings.

En respuesta a Miguel Da Silva

Re: Need help configuring forum's "Reply to post" feature.

por Miguel Da Silva -

I got it!

After checking some more pieces of code I found the «localpart» of a email address can not be longer than 64 characters, and since the IMAP account I set up is 18 characters long, the final reply-to address is 67 characters long; that's why validateAddress() returns false.

On the other hand, here there are a couple of comments regarding the regular expression used to validate an e-mail address. On the notes presented in that link it's also possible to conclude the address length was the root of the problem.

I also found this comment by Andrew Nicols regarding the maximum length for the localpart.

If I am not wrong, the «data» portion of the localpart will be 48 characters long and 1 more character is added (the "+" sign), so, the dedicated email used to retrieve posts sent by mail can not be longer than 15 characters. As I tried to get a more descriptive email as possible I used 18 characters.

As a final observation, I didn't find anything regarding this "limit" in the documentation of the feature (please let me know if I'm wrong) and it seems that it'd be better to get it as part of the instructions.

If I have more novelties about it I'll add a new comment to this post, but for now I can say the feature is working in my environment (Moodle 2.8.3).

Greetings.


En respuesta a Miguel Da Silva

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Thanks for tracking this down Miguel!

That most certainly does explain it, and I'm sorry that it didn't occur to me sooner! This is indeed documented in the developer documentation at https://docs.moodle.org/dev/Inbound_message_API#Summary, but it appears that this did not make it to the user documentation.

The maximum length of the localpart of an e-mail address (including subadress) as defined in RFC 5232, is 64 characters. The current maximum length of the subaddress component is 48 characters, with a further character used for the subaddress separator. This leaves space for 15 characters in the address component.

I'll speak to Mary and Helen about the best way of adding this information, and I've raised MDL-49707 to add checking to the administration setting too.

I'm so pleased to hear that everything is now working in your environment and thank you for all of your hard work in tracking this issue down. We should be able to address this in core so that others will not be affected.

Best wishes,

Andrew

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Lael ... -

We're also trying to configure this with the latest 8.3 and getting the following error in our php log: 


[03-Mar-2015 16:27:52 ] PHP Fatal error:  Class 'Horde_Imap_Client_Socket' not found in \moodle\admin\tool\messageinbound\classes\manager.php on line 100


Any thoughts? We were originally trying to configure it locally with Exchange 2010, but I think it doesn't support  dynamic plus addressing so moved to using a gmail account. 


Thanks!

En respuesta a Lael ...

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Lael,

This sounds like a totally unrelated issue whereby your server is unable to find the relevant php class.

Can you please try purging your caches, and if this does not solve your issue perhaps you could provide information on your web server (not the mail server). We'll need information such as PHP version, Web server + version, OS, etc.

Thanks,

Andrew

En respuesta a Andrew Lyons

Re: Need help configuring forum's "Reply to post" feature.

por Lael ... -

Hi Andrew,


Thanks for your quick reply. I downloaded the latest copy of Moodle before posting this as I was concerned that maybe there was an issue with a missing php file. I've also (just in case) purged the caches again after the upgrade. No change.

Webserver is Apache 2.4.10, PHP is 5.5.13, OS is Win Server 2008 R2.

Thanks!

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Francis Vendrell -

Hello,

I have configured the incoming mail feature with success on one my Moodle sites, but I couldn't make it work on another one.

These two sites are on the same server, same Moodle version, etc..

However the second Moodle site is a secured one (SSL https).

Is it possible that the incoming mail feature doesn't work with SSL secured sites? I noticed that in my second site the reply address of a posted message is not modified from "email@example.com" to something like "email+...@example.com" as is should be.


En respuesta a Francis Vendrell

Re: Need help configuring forum's "Reply to post" feature.

por Francis Vendrell -
********************  Message automatique du répondeur ********************

Bonjour,

Je vous remercie pour votre message.

Le C.E.F.R. a déménagé dans des nouveaux locaux.

Nouvelle adresse:
Avenue de la Praille 29
1227 Genève/Carouge

Nouveaux numéros de téléphone:
Fixe:  022 300 07 02
Mob. : 079 321 07 02

Je me réjouis de vous accueillir prochainement dans les nouveaux locaux.

Francis Vendrell

Centre d'Etudes et de Formation en Reiki
www.cefr.net





En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Francis Vendrell -

Hello again,

I have two questions about the incoming email feature and auto-reply emails.

If a recipient has set up an auto-reply feature, the auto-reply message will be published automatically in the forum.

  • Is there a way to avoid this?
  • Is there a risk that it will be published several times (some kind of infinite loop)?
En respuesta a Francis Vendrell

Re: Need help configuring forum's "Reply to post" feature.

por Francis Vendrell -

I started to use yesterday the incoming email feature.

However I had to deactivate it in the evening because of an auto-reply badly set up by a user. In the mean time, a dozen of auto-reply messages (same user) were published in Moodle. ojo morado

Issue https://tracker.moodle.org/browse/MDL-48164 has dealt with this but it was supposed to be fixed since Moodle 2.8.2 and I am using Moodle 2.8.3....

Is this a bug? mixto What information do you need?

En respuesta a Francis Vendrell

Re: Need help configuring forum's "Reply to post" feature.

por Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi Francis,

If you're able to provide the headers from such e-mails, could you create a new issue.

Unfortunately there is no standard for out-of-office replies. Most mail clients do follow a couple of patterns, but not all.

If you have the headers of the reply which was not caught, then we can see if there are any more headers that we can look for to identify a mail as being automated.

Thanks,

Andrew

En respuesta a Rick Jerz

Re: Need help configuring forum's "Reply to post" feature.

por Chris Tolley -

I'm attempting to configure this feature for the first time using Moodle 2.9.3+ and I'm getting this message in the cron.php output:


Unable to connect to IMAP server. Failed with 'Error connecting to mail server.'


I've defined the mailbox name, the hostname:port (port 993) and tried each of the SSL options available during my tests...all with no success so far.  I'm able to use other applications from the moodle server to successfully connect to the mailbox I want to use, so I know my server:port settings and user/pass info is correct.

I believe I'm having an CA trust issue with the certificate from our Exchange Server.  The admin UI doesn't appear to give me any options for overriding certificate validation or adding any external CA trusts.  Any suggestions on how to overcome this issue?

En respuesta a Chris Tolley

Re: Need help configuring forum's "Reply to post" feature.

por Jürgen Kappus -
Hi Chris, we have similar problem. We have been using the incomming mail feature on Moodle 2.9.x without any trouble. It took half an hour to get the right IMAP Settings.


After upgrading to 3.0.x authentification to the IMAP did not work anymore.

So we tried some different settings without any success.

Using the same settings on the same IMAP servers with a desktop client did work.

We will get deeper into it as we find some time and will report bug if there is one.

En respuesta a Chris Tolley

Re: Need help configuring forum's "Reply to post" feature.

por Ute Hlasek -
Hi Chris, I am using Moodle 3.0.4 and had the same error message using gmail.
I could solve it by NOT giving the port-number, in your case 993.
I configured only smtp.gmail.com
For me it works now.