Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
[vB v2.2.1] SMTP Support and MIME/HTML Emails! Details »
[vB v2.2.1] SMTP Support and MIME/HTML Emails!
Mod Version: 1.00, by fastforward (Member) fastforward is offline
Developer Last Online: Nov 2011 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.2.x Rating: (0 vote - 0 average) Installs: 9
Released: 04 Jan 2002 Last Update: Never Downloads: 1
Not Supported  

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.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Comments
  #2  
Old 04 Jan 2002, 07:09
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
many tx Paul
wonderful hack

PS: will this be compatible with bira's Send Random Password instead of Activation Code Hack?
tia
__________________
Powered by: vBulletin
Reply With Quote
  #3  
Old 04 Jan 2002, 07:19
fastforward fastforward is offline
 
Join Date: Oct 2001
Originally posted by nuno
many tx Paul
wonderful hack

PS: will this be compatible with bira's Send Random Password instead of Activation Code Hack?
tia
I don't see why not. The interface to this hack is really just a replacement for the mail() call, so any thing that sends mail should be able to use this.

Either way... if it's not compatible, I'll make it so

(shuffles off to check Bira's hack)
__________________
BritishExpats.com - (British expatriate community)
Reply With Quote
  #4  
Old 05 Jan 2002, 05:14
fastforward fastforward is offline
 
Join Date: Oct 2001
Post Updated Version

This hack has been updated.

It's now fully featured and allows users to override your control panel setting as to whether they should accept MIME/HTML mail.

The documentation has been updated and completed with detailed instructions on editing all the mail() calls to support HTML templates.

There are some changes to the parameter list for the mime_mail() function call, so if you've installed it already, you'll need to revisit the code changes. Any future updates should be limited to the included classes and won't affect the code changes.

In short... it's done

Please let me know if you come across any bugs. It's very difficult to fully test this kind of hack without emailing hundreds of different people.
__________________
BritishExpats.com - (British expatriate community)
Reply With Quote
  #5  
Old 05 Jan 2002, 05:21
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
okie dokie Paul
i'll test this tomorrow
*too tired bed time*
__________________
Powered by: vBulletin
Reply With Quote
  #6  
Old 06 Jan 2002, 18:11
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
hi Paul
i cant even install this hack to fully test it
Warning: Cannot add header information - headers already sent by (output started at vb\admin\mime_html_smtp.inc:948) in vb\admin\functions.php on line 1491

i cant even login to admin CP now *sux*
__________________
Powered by: vBulletin
Reply With Quote
  #7  
Old 06 Jan 2002, 18:27
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
after hitting login i get this:

Warning: Cannot add header information - headers already sent by (output started at vb\admin\mime_html_smtp.inc:948) in vb\admin\functions.php on line 1491

Warning: Cannot add header information - headers already sent by (output started at vb\admin\mime_html_smtp.inc:948) in vb\admin\functions.php on line 1491

Warning: Cannot add header information - headers already sent by (output started at vb\admin\mime_html_smtp.inc:948) in vb\admin\global.php on line 139

Warning: Cannot add header information - headers already sent by (output started at vb\admin\mime_html_smtp.inc:948) in vb\admin\global.php on line 165

Hang on a sec


then i get kicked to login page again
__________________
Powered by: vBulletin
Reply With Quote
  #8  
Old 06 Jan 2002, 18:31
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
whoa found it
you need to remove last couple of lines at mime_html_smtp.inc file just after ?>
__________________
Powered by: vBulletin
Reply With Quote
  #9  
Old 06 Jan 2002, 19:07
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
arrrghhh i guess i'm blind
where do i set it to send HTML instead of plain text?
__________________
Powered by: vBulletin
Reply With Quote
  #10  
Old 06 Jan 2002, 19:15
fastforward fastforward is offline
 
Join Date: Oct 2001
Originally posted by nuno
arrrghhh i guess i'm blind
where do i set it to send HTML instead of plain text?
In The mail control panel select 'vBulletin Options' in the Side Panel, then '[Email Options]' at the top of that page.
__________________
BritishExpats.com - (British expatriate community)
Reply With Quote
  #11  
Old 06 Jan 2002, 19:22
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
well
there are 7 new fields at email options:
  • Use SMTP
  • SMTP Host
  • SMTP Port
  • This Hostname
  • Requires Authorization
  • SMTP Username
  • SMTP Password

where's the field to specify something like
Send Emails using MIME/HTML?
__________________
Powered by: vBulletin
Reply With Quote
  #12  
Old 06 Jan 2002, 19:31
fastforward fastforward is offline
 
Join Date: Oct 2001
Ahh... oops!

The user selectable option is in the User CP along with the other email notification settings, but it seems I left out the main control panel option.

The way it is now, means unless the user selects 'Text only emails' in their options, MIME will be sent by default.

Give me 10 minutes and I'll add the master switch to the main CP.
__________________
BritishExpats.com - (British expatriate community)
Reply With Quote
  #13  
Old 06 Jan 2002, 19:32
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
okie dokie
__________________
Powered by: vBulletin
Reply With Quote
  #14  
Old 06 Jan 2002, 19:44
fastforward fastforward is offline
 
Join Date: Oct 2001
Just run this to add the missing column

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Everything else is already in place.
__________________
BritishExpats.com - (British expatriate community)
Reply With Quote
  #15  
Old 06 Jan 2002, 19:53
nuno's Avatar
nuno nuno is offline
 
Join Date: Oct 2001
*dang*
no mails are sent now
__________________
Powered by: vBulletin
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 23:30.

Layout Options | Width: Wide Color: