vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   vB Mail Reply (https://vborg.vbsupport.ru/showthread.php?t=68113)

Colin F 08-07-2004 10:00 PM

vB Mail Reply
 
vB Email Reply 0.7BETA


What it does:
This allows your members (and you of course) to reply to threads by email. All they have to do is wirte to a specific email address (that you specify) and include a special code in the email subject.

How it works:
A script (vbemailreply.php) is run using the vB3 Cronsystem every minute. This checks a pop3 or imap account for emails and then processes these emails, inserting the data into the database. Then a reply is sent to the sender, stating that either the post/thread got entered correctly or that there was some kind of error.

Is it complicated?
Actually no. There is an install script that does most of the work as well as two small file changes. If you do have problems installing it, contact me for help.

Changes:
New files (2):
/includes/cron/vbmailreply.php
/includes/mimeDecode.php

Changed files(1):
/includes/functions_newpost.php

New database fields/tables(1):
New userfield added by installscript

New templates(0):

Changed templates(0):

New phrases(3):
emailreplyerror
emailreplydone
emailnewthreaddone

Changed phrases(1):
notify

Screenshots:
none

Credits:
The idea and small parts of the script are based on Chen 'FireFly' Avinadav's Email posts into forum hack, found here: https://vborg.vbsupport.ru/showthrea...threadid=40595

Instructions:
  • Backup all your files as well as your database.
    For help backing up your database, look here: http://www.vbulletin.com/docs/html/m...atabase_backup
  • Upload vbmailreply.php to your /includes/cron/ folder
  • Upload mimeDecode.php to your /includes/ folder
  • Open the file /includes/functions_newpost.php in your favourite PHP editing program.
  • Code:

    FIND (around line 196):
     
    $post['poststarttime'] = trim($post['poststarttime']);
     
    ADD BELOW:
     
    if ($post['isemail']) { $bbuserinfo = $post['userinfo']; }
     
     
    FIND (around line 273):
     
    if ($vboptions['logip'])
     
    REPLACE WITH:
     
    if ($vboptions['logip'] AND !$post['isemail'])
     
     
    FIND (around line 321):
     
    if ($prevpostfound)
    {
     
    ADD BELOW:
     
    if ($post['isemail'])
    {
    return ('dupepost');
    }
    else
    {
     
     
    FIND:
     
    }
    else
    {
    if ($parentid == 0 AND $type != 'thread')
     
    REPLACE WITH:
     
    }
    }
    if (!$prevpostfound)
    {
    if ($parentid == 0 AND $type != 'thread')
     
     
    FIND:
     
            $useremails = $DB_site->query("
                    SELECT user.*, subscribethread.emailupdate
                    FROM " . TABLE_PREFIX . "subscribethread AS subscribethread, " . TABLE_PREFIX . "user AS user
                    LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)
                    WHERE subscribethread.threadid = $threadid AND
                            subscribethread.emailupdate IN (1, 4) AND
                            subscribethread.userid = user.userid AND
                            user.usergroupid <> 3 AND
                            user.userid <> " . intval($userid) . " AND
                            user.lastactivity > " . intval($lastposttime['dateline']) . " AND
                            (usergroup.genericoptions & " . ISBANNEDGROUP . ") = 0
            ");
     
    REPLACE WITH:
     
            $useremails = $DB_site->query("
                    SELECT user.*, userfield.*, subscribethread.emailupdate
                    FROM " . TABLE_PREFIX . "subscribethread AS subscribethread, " . TABLE_PREFIX . "user AS user
                    LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = user.userid)
                    LEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)
                    WHERE subscribethread.threadid = $threadid AND
                            subscribethread.emailupdate IN (1, 4) AND
                            subscribethread.userid = user.userid AND
                            user.usergroupid <> 3 AND
                            user.userid <> " . intval($userid) . " AND
                            user.lastactivity > " . intval($lastposttime['dateline']) . " AND
                            (usergroup.genericoptions & " . ISBANNEDGROUP . ") = 0
            ");
     
     
    FIND:
     
    $evalemail["$languageid"] = '$message = "' . str_replace("\\'", "'", addslashes(iif(empty($email_text[PHRASETYPEID_MAILMSG]), $emails['-1'][PHRASETYPEID_MAILMSG],$email_text[PHRASETYPEID_MAILMSG]))) . '";'.
     
    ADD ABOVE:
     
    $touserfieldcode = "field".$vboptions[mailserver_profilefieldid];
    $subjectcode_reply = "[thread-".$threadinfo[threadid]."-".$touser[$touserfieldcode]."]";
    $subjectcode_newthread = "[newthread-".$foruminfo[forumid]."-".$touser[$touserfieldcode]."]";

  • Add the following as a translation of the phrase notify:
    Code:

    Hello $touser[username],
     
    $bbuserinfo[username] has just replied to a thread you have subscribed to entitled - $threadinfo[title] - in the $foruminfo[title] forum of $vboptions[bbtitle].
     
    This thread is located at:
    $vboptions[bburl]/showthread.php?t=$threadinfo[threadid]&goto=newpost
     
    ~~~~~ NEW ~~~~~
    New at $vboptions[bbtitle]!
    You can now reply to the thread by replying to this message. All you need to do is to make sure this code appears in the email subject:
    $subjectcode_reply
    You should also remove this text to ensure your reply is readable by other forum users.
    Additionaly, you can start a new thread in the $foruminfo[title] Forum simply by sending a mail to $vboptions[mailserver_emailaddress] with this code in the subject: $subjectcode_newthread
    ~~~~~ NEW ~~~~~
     
    Here is the message that has just been posted:
    ***************
    $pagetext
    ***************
     
    There may be other replies also, but you will not receive any more notifications until you visit the forum again.
     
    Yours,
    $vboptions[bbtitle] team
     
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unsubscription information:
     
    To unsubscribe from this thread, please visit this page:
    $vboptions[bburl]/subscription.php?do=usub&t=$threadinfo[threadid]
     
    To unsubscribe from ALL threads, please visit this page:
    $vboptions[bburl]/subscription.php?do=viewsubscription&folderid=all

  • Upload the file vbmailreply_install.php to your admincp folder
  • Be sure to either have a POP3 or IMAP email account ready before running the installation. The data will need to be entered.
  • Open your browser and go to http://www.yourforums.com/admincp/vb...ly_install.php and follow the instructions.
  • Delete the vbmailreply_install.php file from your webserver.
Donations:
This hack will always be free, however your donations are kindly accepted and will help towards further development. If you donate, please leave me some info (either your forum site or username at vB.org) so that I can thank you.

Install:
Don't feel like donating, but still want to thank me for my work? Click the install button to show your appreciation. As a great side effect, you'll get an email update once there is a bigger update or important security fix!

Updates:
09.08.2004 - I've updated the vbemailreply_install.php file, as there was an wrong value while entering the settings.
Also added support for SSL (untested)
Fixed the whole install routine.
03.11.2004 - Updated the installation as well as the vbemailreply.php file.

Colin F 08-08-2004 01:38 PM

Oh my god, it's english!
Well it isn't that hard to translate :)
Translate the three phrases emailreplydone, emailreplyerror and emailnewthreaddone. The error messages are hardcoded into the vbemailreply.php file, you can change them in there if you like.

Can I use this with a mailserver that requires SSL?
Not yet. I haven't built in that function yet, but if you need it, respond in this thread or PM me, then I'll code it in as well.

Deska 08-08-2004 04:13 PM

Nice hack
I'll wait for final release :D

Ming Keong 08-08-2004 04:53 PM

I keep getting these errors:

Warning: imap_open(): Couldn't open stream {mail.myserver.com:143}INBOX in /site/www/includes/cron/vbemailreply.php on line 41

Warning: imap_headers(): supplied argument is not a valid imap resource in /site/www/includes/cron/vbemailreply.php on line 42

Warning: imap_close(): supplied argument is not a valid imap resource in /site/www/includes/cron/vbemailreply.php on line 263

I've tried both pop3 and imap and neither works. (The mail account has been verified to work on both using other means)

Colin F 08-08-2004 05:19 PM

OK, that would mean you can't connect to the mail server.
Can you PM me your mailserver data?

Ming Keong 08-08-2004 05:32 PM

Quote:

Originally Posted by Colin F
OK, that would mean you can't connect to the mail server.
Can you PM me your mailserver data?

Ok, sent. Thx!

Colin F 08-08-2004 05:50 PM

Quote:

Originally Posted by Ming Keong
Ok, sent. Thx!

I updated the vbemailreply.php file, as there seem to be some servers that have to be told that no SSL is required.
This should fix it for all of them.

P.Jackson 08-08-2004 06:49 PM

wow this seems a awsome hack! great work Colin i will await a RC release and install :D

Osterling 08-08-2004 08:08 PM

looks like an incredible hack..

i will have to contemplate if i want this option on my site, but wow, nice hack

TheComputerGuy 08-09-2004 02:59 AM

awesome...I will install this later

Ming Keong 08-09-2004 07:36 AM

Quote:

Originally Posted by Colin F
I updated the vbemailreply.php file, as there seem to be some servers that have to be told that no SSL is required.
This should fix it for all of them.

Unfortunately, I'm still getting the same errors with the new vbemailreply.php

The e-mail test account that I've created for you is still active..

Erwin 08-09-2004 12:28 PM

Do you have PHP compiled with the IMAP module? You may need to judging from those errors. I could be wrong.

Ming Keong 08-09-2004 01:58 PM

Quote:

Originally Posted by Erwin
Do you have PHP compiled with the IMAP module? You may need to judging from those errors. I could be wrong.

Yes, my PHP has been compiled with IMAP.

Logikos 08-09-2004 02:38 PM

Great hacks m8

sabret00the 08-09-2004 02:43 PM

wow, i've been waiting for this, who's got it working thus far?

Colin F 08-09-2004 03:08 PM

I've updated the vbemailreply_install.php and the vbmailreply.php

Ming Keong: I assume you tried with IMAP? I've fixed that as well now. On my board with your data, both IMAP and POP3 work.

you might also want to uninstall and reinstall the hack, as the settings weren't showing correctly.

Sanity 08-09-2004 07:34 PM

Iam sorry, but actually I dont understand how it works exactly. Could somebody be so kind to explain it in "baby-words" to me :shy: (not the installation ;) ).

Colin F 08-10-2004 04:09 AM

Your users (the ones that have it turned on) get a notification when new posts are posted. This hack allows them to reply to that notification by email and to insert a post by email. This means they don't have to visit the board, which is good if
-you're at work and aren't allowed in the internet,
-you don't want everything marked read because you just have time to answer that one post
-(I'll think of more ;))

Are you looking for more technicall details?

Ming Keong 08-10-2004 06:39 AM

The mail server part is working now. Thanks Colin! You've been a great help!

However, like Sanity, and I believe a couple of other users as well, I do not really understand how exactly this hack will work.

I've subscribed to a test thread and replied to it from another user. A notification was received via e-mail. I replied to this e-mail, changing the target e-mail to the e-mail address that the script will process.

The script processed the mail and I received the following error message via e-mail:

Quote:

-----Original Message-----
From: xxx
Sent: Tuesday, August 10, 2004 3:27 PM
To: xxx
Subject: Error: RE: Reply to post 'First post on new server'

Dear ,

We're sorry, but for the reason stated below we could not process your e-mailed reply.

The error that occurred was:


Below is your reply as received at our server:


Sorry,
xxx Team
All the fields are empty.

Is there a specific format that a e-mail must have before it is recognized by the script? For example, where do I place my password? How do I identify my userid? How do I identify the thread I'm replying to? Is it via the title name? Or do I need to enter the threadid manually somewhere?

Sanity 08-10-2004 07:08 AM

Quote:

Originally Posted by Colin F
Your users (the ones that have it turned on) get a notification when new posts are posted. This hack allows them to reply to that notification by email and to insert a post by email. This means they don't have to visit the board, which is good if
-you're at work and aren't allowed in the internet,
-you don't want everything marked read because you just have time to answer that one post
-(I'll think of more ;))

Are you looking for more technicall details?

OK, basically I understand what its good for and it sounds great to me. If there are some problems I'll come back ;)

Colin F 08-10-2004 09:43 AM

There is a codeblock that has to be in the subject title of your email. This (should be) is in your notification email. Unless that doesn't get updated right...

It's in the format of: [post-3-test], that being: [1-2-3]
1: "post" or "thread", indicating if this is a reply to a specific post or to the thread itself
2: the post- or threadid. whatever you indicated in 1
3: your email password.

The rest of the subject line (the code is parsed out) will be the subject of your post.
The whole message will be the content of your post. bbcode, [img] and smilies work.

There's another option on 1, "newthread", and 2 being the forumid. But this isn't tested much...

Ming Keong 08-11-2004 02:43 AM

I think that there's a bug in the install script. For example, for pharse 'emailreplyerror', it appears as follows on my board

HTML Code:

Dear,

We're sorry, but for the reason stated below we could not process your e-mailed reply.

The error that occurred was:


Below is your reply as received at our server:


Sorry,
 Team

Notice that all the variables are missing. That's the reason why I'm getting blank results for my error messages.

The same problem is also happening to all my other vb mail reply pharses. I've since updated all of them manually.

The 'notify' phrase poses a greater problem. In vb3, there is a notify under the phrase type 'Email body text', and one for 'Email subject text'. Adding a 'notify' phrase to the custom phrase doesn't seem to work. I'm still getting the phrase from the default body and subject phrases. I tried to edit those but they cannot be edited. Tried to add a translation to the default phrases and the result is just blank e-mail notifications.

Colin F 08-11-2004 03:52 AM

hmmm ok, thanks.

I guess that means adding some \\\'s to the vars...

I'll also check into the notify thing, as soon as I have time.

teksigns 08-12-2004 12:50 PM

how do you enable the notifications

i cant find a option anywhere

im not getting any notifications except the normal thread reply
notification .....

Ming Keong 08-12-2004 05:10 PM

There are some problems with this hack. For example, when the board sends an e-mail notification with the password, the password should be that of the user receiving the notification. Instead, the board sends the password of the user who last posted.

In addition, some variables in the phrases do not work. I don't think vb can process variables within variables for phrases.

I've managed to brute force my way through everything by changing the variables accordingly, hard coding some stuff, and changing database data directly. It works now.

I'll see if I can consolidate what I've done and post a little something some time next week as I'm really busy this week.

Just off my mind now:
1) Change notify in phrase directly on your mysql database
2) Change the 'post' in the subject to 'thread'
3) Edit the variable within the variable. Hardcode it to $varname[field9] for example, instead of $varname[field$var2]
4) Add the other templates manually into the mysql database
etc...

Colin F 08-12-2004 06:59 PM

OK, I took a look at most of this stuff. I've changed the install routine so that all the templates work.

I don't understand why you want to do 2) and 3) though, Ming Keong.

teksigns 08-12-2004 07:31 PM

Quote:

Originally Posted by Colin F
OK, I took a look at most of this stuff. I've changed the install routine so that all the templates work.

I don't understand why you want to do 2) and 3) though, Ming Keong.

i dont see any updated files .......

Colin F 08-13-2004 05:04 PM

OK, I'm updating the vbemailreply_install.php file now. For those that already have it installed, just uninstall and install again.

This should fix: -templates (expecially notify) not getting updated or getting updated with wrong values
-wrong userpassword in subjectcode

Any more problems anyone?

teksigns 08-13-2004 05:11 PM

Quote:

Originally Posted by Colin F
OK, I'm updating the vbemailreply_install.php file now. For those that already have it installed, just uninstall and install again.

This should fix: -templates (expecially notify) not getting updated or getting updated with wrong values
-wrong userpassword in subjectcode

Any more problems anyone?


are you sure the changes listed in your first post are all thats needed....?

when i installed before and posted a new thread with email notify ...
then i tried to post a reply from another account and get a white page
once i clicked submit .......

Ming Keong 08-13-2004 05:14 PM

Quote:

Originally Posted by Colin F
OK, I took a look at most of this stuff. I've changed the install routine so that all the templates work.

I don't understand why you want to do 2) and 3) though, Ming Keong.


The post variable wasn't working so I added one for the thread. That was why I had to change post to thread. 3) wasn't working on my phrases either so I hardcoded it in instead.

teksigns 08-13-2004 05:20 PM

Quote:

Originally Posted by Colin F
OK, I'm updating the vbemailreply_install.php file now. For those that already have it installed, just uninstall and install again.

This should fix: -templates (expecially notify) not getting updated or getting updated with wrong values
-wrong userpassword in subjectcode

Any more problems anyone?


notify phrase is still not getting updated on my install ....

when i search for phrases with notify in the variable name it finds 2 notify

1 is a Standard Phrase
the other is : Custom Phrase

if i click the edit button on the Custom Phrase one
it only shows the contents of the Standard Phrase one ....


still not getting updated

Colin F 08-13-2004 05:22 PM

Do you have any languages installed other than the default english?

teksigns 08-13-2004 05:24 PM

Quote:

Originally Posted by Colin F
Do you have any languages installed other than the default english?

no i do not .

teksigns 08-13-2004 05:41 PM

i have noticed that the default notify has a language id of -1 if you view it in phpadmin and the notify you add has a language id of 0....

maybe this is the problem

Colin F 08-13-2004 06:04 PM

The -1 language is the master language. The problem is, if I change that, the notify phrase gets overwritten with every update, which I don't want...

Making it language 0 should make it the translation into the default language, which is privileged before the master language.
So actually, 0 should be right...

Colin F 08-13-2004 06:22 PM

Well... what about we change the 0 to 1...

I'll test it and upload the file if it works, but I think this is it.

[€dit]updated, check it out.

teksigns 08-13-2004 06:33 PM

Quote:

Originally Posted by Colin F
Well... what about we change the 0 to 1...

I'll test it and upload the file if it works, but I think this is it.

[?dit]updated, check it out.

well that get me by the first problem ....

however now as long as i have that english translation in place

when i submit a reply to a thread with email notification enabled
it crashes when i clcik submit to a white page (Blank)

must be somehthing in the updated notify that php is not liking


any ideas?

Colin F 08-13-2004 06:55 PM

I can't duplicate that. Can you copy the text of your notify.php here?

teksigns 08-13-2004 07:11 PM

Quote:

Originally Posted by Colin F
I can't duplicate that. Can you copy the text of your notify.php here?


i do not see a notify.php in my dir anywhere .......

i have 3.0.1

not sure if thats something new or not

Colin F 08-13-2004 07:15 PM

the phrase notify

/me hits himself on head


All times are GMT. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01458 seconds
  • Memory Usage 1,862KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete