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


All times are GMT. The time now is 11:02 AM.

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.01675 seconds
  • Memory Usage 1,775KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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