Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vB Mail Reply Details »»
vB Mail Reply
Version: 0.7Beta, by Colin F Colin F is offline
Developer Last Online: Apr 2014 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 08-07-2004 Last Update: 11-02-2004 Installs: 37
Re-useable Code Translations Is in Beta Stage  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 08-10-2004, 09:43 AM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #23  
Old 08-11-2004, 02:43 AM
Ming Keong's Avatar
Ming Keong Ming Keong is offline
 
Join Date: Apr 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #24  
Old 08-11-2004, 03:52 AM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #25  
Old 08-12-2004, 12:50 PM
teksigns's Avatar
teksigns teksigns is offline
 
Join Date: Sep 2003
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how do you enable the notifications

i cant find a option anywhere

im not getting any notifications except the normal thread reply
notification .....
Reply With Quote
  #26  
Old 08-12-2004, 05:10 PM
Ming Keong's Avatar
Ming Keong Ming Keong is offline
 
Join Date: Apr 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #27  
Old 08-12-2004, 06:59 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #28  
Old 08-12-2004, 07:31 PM
teksigns's Avatar
teksigns teksigns is offline
 
Join Date: Sep 2003
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 .......
Reply With Quote
  #29  
Old 08-13-2004, 05:04 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #30  
Old 08-13-2004, 05:11 PM
teksigns's Avatar
teksigns teksigns is offline
 
Join Date: Sep 2003
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 .......
Reply With Quote
  #31  
Old 08-13-2004, 05:14 PM
Ming Keong's Avatar
Ming Keong Ming Keong is offline
 
Join Date: Apr 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:40 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05419 seconds
  • Memory Usage 2,329KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_html
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete