ElkArte Community

Project Support => Support => Topic started by: edweiss on May 06, 2018, 11:25:52 am

Title: Post/reply by email not working?
Post by: edweiss on May 06, 2018, 11:25:52 am
Hello all,

I am new to ElkArte but I am really looking forward to using it!

I've tried setting up post/reply by email and it doesn't seem to be working. I've done the following:
-Enabled the core feature
-Added the proper forwarding addresses with piping enabled to the PHP scripts
-Changed permissions of the emailpost and emailtopic files to 755.

Now, nothing seems to happen when I try to reply or post. There's nothing in the PHP error log, and I don't receive any bounced-back messages.

Any suggestions?
Title: Re: Post/reply by email not working?
Post by: Spuds on May 06, 2018, 01:14:52 pm
Make sure the shebang line at the start of emailpost and emailtopic are correct for your system/os ...  Read the leading comment in those files for some help on how to check.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 06, 2018, 01:32:43 pm
OK, tried changing it, but now I'm getting a bounceback with the following error message:


PHP Notice:  Undefined index: default_forum_action in /home/wdwbbjsw/forum.gtamaid.info/themes/default/Theme.php on line 737
Title: Re: Post/reply by email not working?
Post by: Spuds on May 06, 2018, 01:44:46 pm
OK ... well at least thats progress, we know the return mail is making it to the system.  I'll have a look into that error.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 06, 2018, 01:46:55 pm
Thanks so much!
Title: Re: Post/reply by email not working?
Post by: Spuds on May 06, 2018, 01:51:52 pm
Could you tell me which version of ElkArte you are using?
Title: Re: Post/reply by email not working?
Post by: edweiss on May 06, 2018, 03:06:45 pm
It's 1.1.3
Title: Re: Post/reply by email not working?
Post by: Spuds on May 06, 2018, 04:32:54 pm
Could you attach your bootstrap.php file here, I just want to check that its current.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 07, 2018, 08:40:00 am
Sure, here it is
Title: Re: Post/reply by email not working?
Post by: Spuds on May 07, 2018, 04:19:31 pm
That file is fine ... I'm really not sure how you are able to generate that error. 

I just installed 1.1.3 to a test forum and the email reply function worked (after I worked around an unrelated issue that needs to be fixed in 1.1.4) 

Do you see any errors in the server mail.log or other error somewhere?   How did you pipe the inbound email to the emailpost.php script?  Just to make sure, you are receiving an email from your forum, like when there is a new post on a board you subscribed to,  you then reply to that and then get a return email bounce with above error?  

Title: Re: Post/reply by email not working?
Post by: edweiss on May 07, 2018, 04:42:18 pm
Hi,

I'm using Cpanel so not sure that I can access mail logs easily... The inbound mail is piped through Cpanel. I'll try once more but yes, I post a new topic on the website, get an email about it, then try to reply that email.
Title: Re: Post/reply by email not working?
Post by: Spuds on May 07, 2018, 04:57:00 pm
Cpanel should do it just fine ....  have not used it in years but did successfully use it with this function.

I think you need to make sure both the script and the directory it is in have permissions of 0755 then you have to setup a new email filter, give it a name and then specify the destination as |/home/username/path/to/emailpost.php (and emailtopic.php only if you are allowing new topics my email)

Title: Re: Post/reply by email not working?
Post by: edweiss on May 07, 2018, 06:44:41 pm
Tried it but still causing the same error message... I'll attach the whole bounced message for your reference.
Title: Re: Post/reply by email not working?
Post by: Spuds on May 07, 2018, 08:42:17 pm
Try removing your | character from your filter ... not sure that's it or not, but the text of your message appears to indicate you are pointing to an invalid endpoint.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 07, 2018, 09:21:40 pm
The pipe is added by Cpanel automatically.

Do you know of any quick script I could use to just test the piping process?
Title: Re: Post/reply by email not working?
Post by: Spuds on May 07, 2018, 09:57:59 pm
When I went to your site via
Code: [Select]
http://forum.gtamaid.info/emailpost.php

it said
Code: [Select]
#!/usr/bin/env php

Please check the first line of your emailpost.php script ... it should be like #!/usr/bin/env/php -q or wherever your php command is located.   Notice in the response there is no / after the env in that response .... You need to enter the full path command line to run php  .... don't forget the -q  ....
Title: Re: Post/reply by email not working?
Post by: edweiss on May 07, 2018, 10:18:14 pm
Still getting the same error message even when I changed the shebang.

I even tried switching to IMAP instead of piping, and I get a "Missing Key" error. It's just not my night for forums!  ;)
Title: Re: Post/reply by email not working?
Post by: Spuds on May 08, 2018, 08:01:48 am
What does the shebang line look like and what flavor of *nix are you running?

IMAP is fine, its just not "instantaneous" so to speak. 

The missing key is the "other" error I referred to above, a little bug introduced in 1.1.3, that we can fix and get you going! 
Title: Re: Post/reply by email not working?
Post by: edweiss on May 08, 2018, 09:17:42 am
I think I might just stick with IMAP if it's easily doable-- what's the fix?
Title: Re: Post/reply by email not working?
Post by: Spuds on May 08, 2018, 10:55:11 am
For now edit Mail.subs.php (I'm not sure this will be the 1.1.4 fix, so keep an eye on things)

Code: (find) [Select]
$unq_head = $unq_head_array[0] . '-' . $unq_head_array[2];
Code: (replace) [Select]
$unq_head = $unq_head_array[0] . '-' . $unq_head_array[1] . $unq_head_array[2];
Title: Re: Post/reply by email not working?
Post by: edweiss on May 08, 2018, 03:31:58 pm
Thanks, this seems to work so far. However, one more issue has come up: I'm getting a "Key Expired" message if I try to reply to a given message more than once. (I've set the key expiration setting to 90 days or something like that in the settings.)
Title: Re: Post/reply by email not working?
Post by: tino on May 08, 2018, 04:56:11 pm
Looking at the code you can only reply to the post once via email until another email is generated by someone else replying. If that makes sense.
Title: Re: Post/reply by email not working?
Post by: Spuds on May 08, 2018, 05:03:40 pm
Correct ... they are use once keys to prevent spamming. 

The key expired means that at least its a legit key, user and topic/message are legit ... so you the admin can still approve it.  I don't see that happen to often but it does happen.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 08, 2018, 08:42:30 pm
I guess the issue is that if multiple people respond simultaneously to a new topic then it won't work. This seems to happen to fairly frequently on our listserv, so I'm not sure if this is going to work...
Title: Re: Post/reply by email not working?
Post by: Spuds on May 08, 2018, 09:44:28 pm
Its unique to each specific user ... not to the message.  So if 100 users "subscribe" each can reply to the original message w/o any issue.
Title: Re: Post/reply by email not working -- file attachments not posting properly
Post by: edweiss on May 08, 2018, 10:39:17 pm
Ah, ok, I see... 

One more thing -- and I'm so sorry to keep bugging you about all this!

I've tried replying by email with a file attachment and the attachments gets posted to the forum but gets attached to the wrong reply (see screenshot, the PDF file 'billing units' is supposed to be attached to the last reply.) The attachment doesn't seem to make it through by email.

Any suggestions? Known bug?
Title: Re: Post/reply by email not working?
Post by: Spuds on May 09, 2018, 08:16:23 am
I'll have to check the attachment code, that sounds like a bug.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 09, 2018, 08:50:03 am
While you're at it... Are attachments supposed to be forwarded to people who are subscribed to a topic?

(Thanks, I owe you guys if this all does work out for us!)
Title: Re: Post/reply by email not working?
Post by: Spuds on May 09, 2018, 09:06:52 am
If I recall correctly, it will only report that there are attachments and provide the link, I don't think it includes them in the outbound notification.
Title: Re: Post/reply by email not working?
Post by: edweiss on May 11, 2018, 12:16:37 am
Quick update... I discovered that even when using cron to fetch the IMAP messages, it only works if guest browsing is enabled. (I posted a new bug report about this.) Now, when I try piping, this is the error message I get when the email bounces back:

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:

  pipe to |/home/wdwbbjsw/forum.gtamaid.info/emailpost.php
    generated by test@forum.gtamaid.info

The following text was generated during the delivery attempt:

------ pipe to |/home/wdwbbjsw/forum.gtamaid.info/emailpost.php
       generated by test@forum.gtamaid.info ------

X-Powered-By: PHP/7.1.17
Content-type: text/html; charset=UTF-8



Reporting-MTA: dns; s1.kickassd.com

Action: failed
Final-Recipient: rfc822;|/home/wdwbbjsw/forum.gtamaid.info/emailpost.php
Status: 5.0.0


Title: Re: Post/reply by email not working?
Post by: edweiss on May 17, 2018, 10:21:41 pm
Quote from: Spuds – I'll have to check the attachment code, that sounds like a bug.
Any luck with this one?