Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by fastforward fastforward is offline
Developer Last Online: Nov 2011 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 01-03-2002 Last Update: Never Installs: 9
 
No support by the author.

This hack adds additional email features to vB 2.2.1
  • Allows you to send mail via SMTP instead of using the site wide settings
    in your php.ini.
  • Allows you to send email as MIME/HTML with a plain text part allowing
    almost all email clients to view the email in a readable format.
  • Any combination of the above are selectable via the control panel.
Latest version is 20020106

I initially wrote this to enable SMTP email and get around a problem I was having with my emails not being delivered to AOL users. I believe it must have something to with my php.ini. But then I decided I might as well expand on the idea.

In addition to the SMTP capability, this hack adds MIME/HTML capablities to vB. There is no need to worry whether a user can read HTML. You simply send send both versions in the same MIME mail. The email client will display whatever it can or wants.

I've noticed a couple of hacks that allow you to send HTML email from vB. Both of them simply add the Content Type: text/html in the header and send it as normal. This is all very well for a handful of the newest email clients, but if the recipient can't or doesn't want to recieve HTML mail, the message is almost unreadable. The two obvious solutions are to either make it user selectable or send both types in MIME format. This hack does both. It allows users to select whether they receive HTML or text emails via the user control panel but sends MIME as default.

This approach required a quite lot of code changes, so for those of you don't want the headache of changing all the code, this hack has two levels of install. You can do the simple install first, which gives most of the features without the user selectable option. If you like it, you can do the second level install later.

Full instructions for the second level install are in the attached zip.



Overview:
There are two levels of installation to this hack. The first method is simple. The SQL commands will make the global settings visible in the control panel under 'vBulletin Options => Email Options' section. It also creates an example template for testing the new reply notifications.

The uploaded file contains all the functions/classes required.

It is then just a case of adding a require() in both global.php files and replacing the existing mail() calls in the code with the new mime_mail(). All the other parameters in the function call remain the same. Can't get much easier than that! At this level, you will be able to opt whether to send mail via SMTP or the method specified in your existing php.ini file. HTML mail can also be sent from any form that accepts input, ie. the mass emailer. Simply enter HTML in the form and the hack will generate the plain text automatically and send a complete MIME message to all recipients. HTML is either globally on or off via the control panel with this level of installation.

The second level of installation requires that you add a few more parameters to the mime_mail() function in addition to what was there originally. This allows you to use HTML templates to send mail where appropriate. It also allows the user to select whether they should recieve HTML mail regardless of your CP settings. You can make these changes without creating additional custom templates immediately. Everything will work as in the basic install. You can then add the templates at your leisure by creating a new one with the same name and '_html' at the end. There a few more lines of code to add for this level of install but it's still pretty straightforward.


The mime_mail() function can be used in other scripts/hacks and takes the
following parameters:
Recipients email address
Email subject
Plain text message (optional) defaults to auto generated from HTML message
From Header (optional) defaults to $bbtitle Mailer <$webmasteremail>
HTML Message (optional) defaults to auto generated from text message
Force Text Only (optional) defaults to FALSE

If either the plain text or the html parameter is null, the correct format is generated automatically from the other one. Obviously at least one of the parameters must be there.



Quick Example:
These two lines will replace the existing mail() function and provide
HTML mail via a new template you created. It will also use SMTP if
specified in the control panel.
Code:
eval("\$emailmsghtml = 
      \"".gettemplate("email_notify_html",1,0)."\";");
mime_mail($touser[email], 
          $emailsubject, 
          $emailmsg, 
	  $emailmsghtml);

Show Your Support

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

Comments
  #22  
Old 01-06-2002, 07:55 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Version 4.1.0.
I'm running Apache Version 1.3 and IIS5 Default SMTP Server.
Reply With Quote
  #23  
Old 01-06-2002, 08:02 PM
fastforward fastforward is offline
 
Join Date: Oct 2001
Location: NC, USA
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nuno
PHP Version 4.1.0.
I'm running Apache Version 1.3 and IIS5 Default SMTP Server.
Is Apache on Windows too, or just the SMTP server? I haven't tested this with Windows.

If you still want to keep trying with this, could you add a debug line in mime_html_smtp.inc file in the mime_mail() function to identify the point at which it fails?

Put
Code:
echo "DEBUG\n"; exit;
at the first line then keep moving it down until it no longer shows up.

I'll understand if you don't have the time
Reply With Quote
  #24  
Old 01-06-2002, 08:06 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yup Apache and SMTP Server
ok lets start then
Reply With Quote
  #25  
Old 01-06-2002, 08:09 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Warning: Missing argument 6 for mime_mail() in vb\admin\mime_html_smtp.inc on line 16
DEBUG
Reply With Quote
  #26  
Old 01-06-2002, 08:26 PM
fastforward fastforward is offline
 
Join Date: Oct 2001
Location: NC, USA
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nuno
Warning: Missing argument 6 for mime_mail() in vb\admin\mime_html_smtp.inc on line 16
DEBUG
Change the first line of the mime_mail() functin to this
Code:
function mime_mail ($tomail, $subj, $txtmsg='', $from='', $htmlmsg='', $textonly=FALSE) {
Reply With Quote
  #27  
Old 01-06-2002, 08:44 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm
should i stop IIS5 SMTP Server?
Reply With Quote
  #28  
Old 01-06-2002, 08:49 PM
fastforward fastforward is offline
 
Join Date: Oct 2001
Location: NC, USA
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nuno
hmm
should i stop IIS5 SMTP Server?
When? why?
This hack still needs a real SMTP server to be available. It doesn't send mail directly to the recipients remote mail server.
Reply With Quote
  #29  
Old 01-06-2002, 09:00 PM
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i c
dunno whats wrong with my settings, but i cant make this hack to work with my server
i'm forced to uninstall it
tx 4 all your help Paul
Reply With Quote
  #30  
Old 01-11-2002, 12:13 AM
chaz7979 chaz7979 is offline
 
Join Date: Nov 2001
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just want to set up my board so that the email notify mails go out in html so html links can be read. If people don't have html they will jsut see the code and be able to read the rest of the email text right?

If so How can I set up the board to do that? Should be a matter of adding a MIME header to the mail code but I don't know where that is. Any help you could give me would be great.
Reply With Quote
  #31  
Old 01-11-2002, 12:27 AM
fastforward fastforward is offline
 
Join Date: Oct 2001
Location: NC, USA
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by chaz7979
I just want to set up my board so that the email notify mails go out in html so html links can be read. If people don't have html they will jsut see the code and be able to read the rest of the email text right?

If so How can I set up the board to do that? Should be a matter of adding a MIME header to the mail code but I don't know where that is. Any help you could give me would be great.
There's a bit more to it than adding a MIME header. You need to actually encode the HTML using base64. All the necessary functions are available in php, or you can use one of the php classes distributed at zend.com, or you can use this hack and only change the mail() call to mime_mail() in the relevent file that sends notify messages (functions.php).
Reply With Quote
Reply

Thread Tools

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 08:44 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.04504 seconds
  • Memory Usage 2,311KB
  • 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
  • (3)bbcode_code
  • (4)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
  • (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