Version: , by fastforward
Developer Last Online: Nov 2011
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.
Originally posted by chaz7979 So if I just do the first 2 steps (simple install) I should be all set?
I have one concern 2. c. says
If you are doing a full install, you can skip this:
Go through the vB files and replace all occurances of
'mail(' with 'mime_mail('
All the files? There is a lot of files that make up VB. Do we really have to go through every single file? How many instances are there?
That really means 'Go through the vB files and replace all occurances of mail().. for which you wish to use the new MIME or SMTP functionality.'
The full install instructions actually list all the bits that need changing. That will include all the mail() calls. There's not really that many compared to some of the hacks here.
In your case, you should be able to just do the simle install (ie. steps 1 & 2. then follow the step in the instructions that changes the mail() call in functions.php which is 6a.
Code:
A) ADMIN/FUNCTIONS.PHP
OLD CODE
--------
mail($touser[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
NEW CODE
--------
// START MIME/HTML/SMTP HACK
eval("\$emailmsghtml = \"".gettemplate("email_notify_html",1,0)."\";");
mime_mail($touser[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>", $emailmsghtml, $touser[emailtextonly]);
// END MIME/HTML/SMTP HACK
Don't forget to create a template called email_notify_html.
Was wondering if anyone could help me with the following error I'm getting trying to send email to a member after installing the SMTP Hack (full install) by fastforward?
Database error in vBulletin 2.2.2:
Invalid SQL: SELECT username,email,showemail, FROM user WHERE userid='1'
mysql error: You have an error in your SQL syntax near 'FROM user WHERE userid='1'' at line 1
Just so I'm being thorough, here's the code I believe is causing the error in members.php:
// START MIME/HTML/SMTP HACK
$destuserinfo=$DB_site->query_first("SELECT username,email,showemail,$emailtextonly FROM user WHERE userid='$destuserid'");
// END MIME/HTML/SMTP HACK
Invalid SQL: SELECT DISTINCT user.email,.emailtextonly FROM moderator,user WHERE moderator.userid=user.userid AND forumid IN (2,1,-1) AND (newthreademail=1 OR newpostemail=1)
mysql error: You have an error in your SQL syntax near 'FROM moderator,user WHERE moderator.userid=user.userid AND forumid IN (2,1,-1) A' at line 1
Your problem is with the $emailtextonly variable. Are you sure you added the column with the 'DEFAULT 1' option? Also, check the template modifications for the CP to make sure it defaults to 1.
Do a query on the user table and see if you have any null values for the emailtextonly column.
Originally posted by fastforward
[B]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.
Excuse the bump but it's a nice feature.
Just a question: is it possible send attachments with this kind of mail ?
Standard MIME should permit that... How could I send - for example - something attached to the webmaster email under certain conditions ?
I've been holding off on upgrading to 2.2.2+ b/c i was waiting on a new version hack of this to come out.. Does anyone know if this works on 2.2.5? This is the only hack i've ever installed and it kinda scares me when i do anything like this.. I really wish SMTP support was included into vbulletin without having to do any hacks. If anyone has tried this in 2.2.5 plz let me know, Thanks
-X69
just installed it on 228 and i can't even log in to admin CP, have nothing to delete on mime_html_smtp.inc after <?
what should i do? help me please :banana: