vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Send HTML emails from adminCP (https://vborg.vbsupport.ru/showthread.php?t=99910)

tokenyank 11-01-2005 10:00 PM

Send HTML emails from adminCP
 
***3.6.x version of hack here***

Well, this was asked for by many people (me included :) ) without ever being done so I recruited some of my more knowledgable friends in php to get the syntax right for the following hack.

It is done with 2 file edits but I'm sure that it could be done with a plugin if someone ever feels the need...


Step 1:
In admincp/email.php find:

Code:

print_textarea_row($vbphrase['message_email'], 'message', '', 10, 50);
Directly below it place:
Code:

print_yes_no_row('Send HTML Email?', 'sendhtml', 0);
Step 2:
In admincp/email.php find:

Code:

construct_hidden_code('test', $vbulletin->GPC['test']);
Directly below it place:
Code:

construct_hidden_code('sendhtml', $_POST['sendhtml']);
Step 3:
In includes/class_mail.php find:
Code:

$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
and replace with:
Code:

if($_POST['sendhtml'])  {
  $headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
}else{
  $headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
}

Special thanks goes to non vB users Darryn, Pink, DO, and Dang for the helping me with syntax and pointing me in the right direction to get this done.

(you may modify this hack at will... No permission needs to be granted)

EDIT:
Just installed on 3.5.1 and still works with no problem... Just changing the vB version
EDIT2:
Just installed on 3.5.2 and still works with no problem... Just changing the vB version
EDIT3:
Just installed on 3.5.3 and still works with no problem... Just changing the vB version
EDIT4:
Works for 3.5.4

RS_Jelle 11-02-2005 04:17 PM

Thanks, I really needed this :up:

[high]* RS_Jelle clicks install :)[/high]

FleaBag 11-02-2005 06:15 PM

Thats wicked. Do you know of a guide to writing HTML e-mails I can reference?

Ryan McBain 11-02-2005 07:22 PM

This is great. Can anyone turn this into a plugin please?

Ghanem 11-02-2005 09:22 PM

thank you very very much

phonexpo 11-06-2005 03:53 PM

Installed, thanks been looking for this for ages - well done.....

OsMoSiS.it 11-09-2005 11:56 AM

More "vBulletin style" coded (hardened security by using $vbulletin->GPC) version of the same modification :)


In admincp/email.php find (line 62):
Code:

                'message'          => TYPE_STR,
After add:
Code:

                'sendhtml'          => TYPE_BOOL,

Find (line 253):
Code:

        construct_hidden_code('perpage', $vbulletin->GPC['perpage']);
After add:
Code:

        construct_hidden_code('sendhtml', $vbulletin->GPC['sendhtml']);

Find (line 286)
Code:

                print_textarea_row($vbphrase['message_email'], 'message', '', 10, 50);
After add:
Code:

                print_yes_no_row('Send HTML Email?', 'sendhtml', 0);

In includes/class_mail.php find (line 249):
Code:

                $headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
replace with:
Code:

                if ($vbulletin->GPC['sendhtml'])
                {
                        $headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
                }
                else
                {
                        $headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
                }


Ryan McBain 11-12-2005 08:14 AM

I had lots of problems with this hack so I had to uninstall. When I post new threads on my board I had problems. I would get errors. If I posted an image in the thread I would good an error coming from the includes/class_mail on line 249.

And even if post a regular post, I my page would get stuck. The posts would still go on put I would get these errors.

tokenyank 11-13-2005 03:56 PM

You must have had a typo or missed out a character or something in the install as I've been running it since I posted the code here and haven't had a problem at all...

I do have to say that I'm confused to why you'd get errors in class_mail if you post an image! Try from fresh files and make sure you don't delete a ; or ' accidentally...

(this assumes you tried mine and not OsMoSiS.it's code edit as I have no idea what he did and the possible ramifications of a typo! :D )

hoangminh 11-18-2005 09:00 AM

Quote:

Originally Posted by tokenyank
You must have had a typo or missed out a character or something in the install as I've been running it since I posted the code here and haven't had a problem at all...

I do have to say that I'm confused to why you'd get errors in class_mail if you post an image! Try from fresh files and make sure you don't delete a ; or ' accidentally...

(this assumes you tried mine and not OsMoSiS.it's code edit as I have no idea what he did and the possible ramifications of a typo! :D )

Yeah, I think that Ryan McBain has modified other class than mail, if you post image or any other, I think the class_mail can not be used

Thanks for greate hack. Installed. I need it for long time.


All times are GMT. The time now is 07: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.01121 seconds
  • Memory Usage 1,748KB
  • 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
  • (14)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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