View Full Version : Send HTML emails from adminCP
tokenyank
11-01-2005, 10:00 PM
***3.6.x version of hack here*** (https://vborg.vbsupport.ru/showthread.php?t=137537)
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:
print_textarea_row($vbphrase['message_email'], 'message', '', 10, 50);
Directly below it place:
print_yes_no_row('Send HTML Email?', 'sendhtml', 0);
Step 2:
In admincp/email.php find:
construct_hidden_code('test', $vbulletin->GPC['test']);
Directly below it place:
construct_hidden_code('sendhtml', $_POST['sendhtml']);
Step 3:
In includes/class_mail.php find:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
and replace with:
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:
* RS_Jelle clicks install :)
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):
'message' => TYPE_STR,
After add:
'sendhtml' => TYPE_BOOL,
Find (line 253):
construct_hidden_code('perpage', $vbulletin->GPC['perpage']);
After add:
construct_hidden_code('sendhtml', $vbulletin->GPC['sendhtml']);
Find (line 286)
print_textarea_row($vbphrase['message_email'], 'message', '', 10, 50);
After add:
print_yes_no_row('Send HTML Email?', 'sendhtml', 0);
In includes/class_mail.php find (line 249):
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;
replace with:
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
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.
She Unlimited
11-18-2005, 09:26 AM
Sorry, how can I find the send email.php template...
:nervous:
hoangminh
11-18-2005, 09:46 AM
Sorry, how can I find the send email.php template...
:nervous:
not template, edit files, it's admincp/email.php
Read carefuly before you start your work.
FleaBag
11-18-2005, 01:01 PM
OsMoSiS.it, what does your more secure version protect against?
She Unlimited
11-18-2005, 01:08 PM
I have never edit files before, but if you could give me a pointer...sorry.... :nervous: :o
FleaBag
11-18-2005, 01:20 PM
You'll need a file editor. Try EditPlus (http://www.editplus.com). The majority of file editing is copying and pasting, with a bit of searching. Just use the search and search/replace in EditPlus. I'm assuming you can FTP files if you have vB installed. :)
fabianv
11-27-2005, 02:15 PM
Thank you for this.
She Unlimited
11-27-2005, 10:41 PM
You'll need a file editor. Try EditPlus (http://www.editplus.com). The majority of file editing is copying and pasting, with a bit of searching. Just use the search and search/replace in EditPlus. I'm assuming you can FTP files if you have vB installed. :)
LOL...yes thank you.... :nervous:
KevNJ
12-02-2005, 01:49 AM
::clicks installs ::
INSTALLED!!!
Works PERFECTLY!!!!!
I went to send out my first newletters for my site tonight, and after sending some test emails realized sending html emails wasnt an option. So came over here, and found this mod right away. Edited the files like it says. Works like a charm!
Thanks for taking the time to do this!
Awesome!!
Watson
12-08-2005, 11:52 AM
Works a Treat. Superb. Love it
Thanks for this
Andreas
12-08-2005, 12:23 PM
Step 3 an be done with a Plugin, the other ones could be done (not 100% sure without impementing it) with Plugins too.
And I strongly recommend to use the modified version from this post (https://vborg.vbsupport.ru/showpost.php?p=816607&postcount=7)
tidy_boy
12-13-2005, 06:53 AM
excellent hack would be good if plugin was made forit tho to save file edits
mwhoob
12-13-2005, 10:22 AM
problem with arabic
im sad
tidy_boy
12-13-2005, 02:59 PM
Hi there I did the changes in the first post. Then I sent out a html email and got a db error
Database error in vBulletin 3.5.2:
Invalid SQL:
UPDATE vb3_session
SET lastactivity = 1134492878, location = '/forum/admincp/email.php?do=dosendmail', inforum = 0, inthread = 0, incalendar = 0, badlocation = 0
WHERE sessionhash = 'cb72da628436727c8a87044cb2eb0927';
MySQL Error : Lost connection to MySQL server during query Error Number : 2013
Date : Tuesday, December 13th 2005 @ 05:56:19 PM
Script : http://www.harddanceaddict.net/forum/admincp/email.php
Referrer : http://www.harddanceaddict.net/forum/admincp/email.php?do=start
IP Address :
Username : tidy_boy
Classname : vb_database
Any ideas?
silurius
12-13-2005, 03:16 PM
Anxious to install but I have so many hacks already I'm going to await the plugin version.
tidy_boy
12-13-2005, 03:31 PM
Anxious to install but I have so many hacks already I'm going to await the plugin version.
Hi there mate the hack works. My html email got sent out but I got this one error
Baitona
12-14-2005, 11:39 AM
tokenyank
It is a wonderful hack, working 100%
problem with Arabic
im sad
mwhoob :)
Yes it has a little problem with Arabic, since AJAX features doesn't support Arabic characters.
From now until someone figures out how to let AJAX support Arabic features you need to disable the AJAX inside your forum, then this hack will work 100%
I have tested it my self, and it is a wonderful hack.
Go to:
Vbulletin Option>>>>> General Settings>>>> Disable AJAX Features
Then Choose,
Disable Problematic AJAX Features
Baitona
zendiver
12-14-2005, 09:43 PM
Token, awesome...just tested this on 3.5.2 and without even so much as a hick-up so far.
Great job.
phonexpo
12-16-2005, 10:15 AM
Token, awesome...just tested this on 3.5.2 and without even so much as a hick-up so far.
Great job.
Yeah great hack... I've just reinstalled it on 3.5.2 ... :)
Smiry Kin's
12-23-2005, 12:31 AM
3.5.2
works great, even found a simple simple! way to make a newsletter :)
*install
hi tried installing this on 3.5.2, i couldnt belive but i cant find this line in email.php :
construct_hidden_code('test', $vbulletin->GPC['test']);
whatam i missing!
nor there is the class_mail.pho in includes directory!
phonexpo
01-09-2006, 01:00 PM
Working with 3.5.3 :)
The Chief
01-26-2006, 05:57 PM
thanks for this cool mod :)
* The Chief clicks install
Gizmo999
02-02-2006, 06:33 PM
Giz clicks "install" thanks for the hack.
One small suggestion or maybe someone can tell me how to add a "receive html newsletter" preference to the user options under their receive admin email selections.
I created it in user profile fields added it to options/messaging notification but now can't see it anywhere :(
Annie^.^
02-07-2006, 01:16 AM
installed and works great
Xzyte
02-21-2006, 09:00 PM
Just upgraded my board to 3.5.4 and it still works great with no problems at all. :)
Great work tokenyank! Thanks.
Hello,
This is what I was looking for.:cool:
It'is working just fine.
Thank you for this hack.
Sjox
Smiry Kin's
03-15-2006, 12:22 AM
anywa to make it send n email using the forum skin in away?
masterross
03-19-2006, 11:06 PM
any hints how to modify it to send HTML welcome mails too??
thanks,
Ross
Dragon Company
04-24-2006, 06:24 PM
Works perfectly !! Thanks a lot !
swantonio
04-28-2006, 10:57 AM
perfect Install :-)
misticjeff
05-01-2006, 04:25 AM
When I send html emails my images are not showing up.. anyone have any ideas??
Dragon Company
05-02-2006, 08:06 AM
Hello,
strange can't send it more than 100 mails in html mode ... Is there something to change for have a bigger limit ?
Regards
EDIT _ thats okay, problem solve .. thanks again
misticjeff
05-04-2006, 10:14 PM
Hello,
strange can't send it more than 100 mails in html mode ... Is there something to change for have a bigger limit ?
Regards
EDIT _ thats okay, problem solve .. thanks again
What did you do to solve it?? Please share....
anywa to make it send n email using the forum skin in away?
Good idea. Any one can work it out ?
zeropaid
05-11-2006, 08:03 PM
Sweet mod, *clicks install*
Quick question to all, has anyone got the from field to read anything better than just an email address? I tried
OUr Website <noreply@domain.com>
and several variations on that to no avail. Any ideas?
Also has anyone tried sending like 200,000+ mails using this method?
I tried but nothing worked. It shows that emails have been sent but when I check my email nothing was received. It works when you insert only the email. But I see that other sites can work this out like this forum.
The subject is vBulletin.org
and the sender is vBulletin.org<webmaster@vBulletin.org>
Does any one know to do it like this ?
OllieRocks
05-21-2006, 11:04 AM
Brilliant. Thanks
* OllieRocks clicks install :)
Battle_Ring
06-02-2006, 08:19 PM
is there a way t oget this to work with 3.0.7
Crazy Serb
06-07-2006, 04:46 AM
is there any way to set up Content-Type to "multipart/alternative" so that if I send out an HTML email to a user who can only view plain text version of it he gets just that?
ThomasR
06-11-2006, 04:13 PM
Battle_Ring: do a search. I use this modification on my 3.0.7 without any problems.
For those of you who have problems with the images, you need to host them on your server (or any server) and enter the url in the <img src="your url"> code, like : <img src="http://www.toto.com/img/mynewsletterimage.jpg">
demojames
06-12-2006, 05:08 AM
Installed. Worked Great, Thank You!
Hypocrisy
06-12-2006, 05:35 AM
It works very well :)
futuredood
06-22-2006, 02:10 AM
great, thanks on 3.5.4
Miss Tiina
06-26-2006, 01:50 AM
YAY! Thanks so much!
AzzKikr
06-29-2006, 03:46 AM
Works on 3.6 Beta 3 with no issues.
(Why they haven't built it into VB yet... *sigh*)
-A.
lanc3lot
06-29-2006, 09:20 AM
Installed, is there any way to set always on the setting html emails?
Thnx,works fine:)
aacircle
07-14-2006, 12:41 PM
Perfect! Thanks for a great hack. Yes, it seems too simple. Why isn't it a standard I wonder...
masterross
07-22-2006, 03:16 PM
anyone knows what to write in "from" field so when user recieved mail will be display from: "My Forum name"
insted of mymail @ mydomain.com
i've test:
"My Forum name" <mymail @ mydomain.com>
'My Forum name' <mymail @ mydomain.com>
but not works
thanks in advance
beduino
09-01-2006, 03:24 PM
Hello,
tests with vb 3.6.0?
tks !
beduino
navjotjsingh
09-09-2006, 06:28 PM
Worked perfectly on vBulletin 3.6.0 also. This mod should now show version supported 3.6.0 instead of 3.5.4!
Great hack, looking for the exact thing. How would I include images in the email? With image tag and path to the image?
Thank you .-)
Dragon Company
09-13-2006, 07:56 PM
works fine with 3.5.5 too ! Many thanks
bollie
09-17-2006, 07:45 AM
Work for 3.6.1 ;)
PoetJA-1975
09-27-2006, 11:03 AM
Very nice sharing - Thank you very much :)
Jacquii.
cnczone
10-03-2006, 07:40 PM
how can I get this to work for 3.6.0?
navjotjsingh
10-07-2006, 02:20 PM
It already works with 3.6.0 ... just follow the steps given above. And now it works on 3.6.2 also!
bollie
10-09-2006, 05:54 PM
work for 3.6.2
bollie
10-09-2006, 05:54 PM
move
firefox100
10-13-2006, 01:15 PM
Works fine with 3.6.1!
Thanks tokenyank ;)
Works in 3.6.2 as well :)
Well done!
siriuxs
10-14-2006, 06:07 AM
It exist for vbulletin 3.6.x ???
AzzKikr
10-20-2006, 12:03 AM
Yup - just insert the above code into your 3.6.x install as required.
Works beaut :)
-A.
SnitchSeeker
10-21-2006, 02:05 PM
Thanks, I installed it on vb 3.6.2.
But where do I go to send html mail now?
EDIT: Nevermind, I found it.
It was in admincp > Users > Send mail to users
SnitchSeeker
10-21-2006, 05:22 PM
I sent out two or thre test e-mails over three hours ago but have still not received them.
Why are so many people saying it works?
PoetJA-1975
10-21-2006, 11:59 PM
I sent out two or thre test e-mails over three hours ago but have still not received them.
Why are so many people saying it works?
Test Email Only?
(Will not send any email out)
well - I don't think you would receive them - they're TEST emails right?
test it by sending just to ADMIN user group - test email only set to no.
Jacquii.
ps - works like a charm ;)
farukcan
10-22-2006, 03:10 PM
Installed, thanks
SnitchSeeker
10-23-2006, 12:00 PM
Test Email Only?
(Will not send any email out)
well - I don't think you would receive them - they're TEST emails right?
test it by sending just to ADMIN user group - test email only set to no.
Jacquii.
ps - works like a charm ;)
You're right! That was the reason I didn't get an e-mail...
BUT now that I got it to send a mail (by not having Test Email Only? checked) in my mail, instead of seeing HTML rendered, I get the HTML code spelled out like a regular text-mail (with the tags and everything). It doesn't render! :(
Are there rules we are supposed to follow on how to write the mails? Only certain tags supported? I entered HTML as though it was a web-page (with <head> and <body> and everything)!
CRBadBeat
10-23-2006, 04:22 PM
There is a toggle switch to choose HTML or not that is default no. Just make sure you click the yes box.
PoetJA-1975
10-24-2006, 12:52 AM
There is a toggle switch to choose HTML or not that is default no. Just make sure you click the yes box.
yep :)
Jacquii.
SnitchSeeker
10-24-2006, 09:55 AM
Oh thank you!
I can't believe I am making these silly mistakes...
EDIT: Yippi!! This works perfect! Sweet! :)
Cheers all! :)
JulianWolf
10-30-2006, 04:56 PM
If somebody could combine this with a "Subscribe whole Forum"-Thread, this is a great Newsletter-Tool.
Well, all parts are existing somewhere already. So just some kind of "wishlist":
Give users an Option called "HTML or plain-text-mails"
Make two Textareas, one for the plain text, one for the html, in the Backend.
Now the Newsletter-Funktionality is easy. User can choice between HTML, Plain Text or "no eMails". For sending a Newsletter you can just write the plain-text in the one, the HTML in the other Box and each user get?s the one he wants to have.
Next point: Inster "alternate" eMail-Texts. So notifier-Mails for new PMs, for new posts and so on are also sent in HTML, if the user wants to.
Built up an "subscribe to forum"-Funktion. I?m using vBa with one forum-thread for the news on the start-page. When a User can subscribe the forum (one mail for every first post of a new thread in a forum ore a weekly overview over the first post of all new threads) then there is a great interactive Newsletter-function.This would be a great Newsletter-Hack with lots of good ways in it. The newsletter can work automatically (subscribe new threads of news-forum), choisable in HTML or plain-text, it can be choisen by the user if he wants it instant or weekly (or monthly?), the save subscribe- and unsubscribe-links are built-in in vBulletin already an extra-newsletter can be sent manualy with the backend, users can sign-off easily in the backend ... what do you think?
Two nice add-ons:
Get the variables "new PMs", "new threads", "new pagers", "profile-views" and so on into this eMail. So a user sees in each eMail, how many PMs he has and so on. We could also put it "new users" or "new member-fotos" and so on, to get all of the users more and more in action.
A backend-advertisement-control. Let?s say we put in an $advertisement in the mail-templates, then in the admincp can be managed with usergroups and other queries (reputation, genter, ZIP-Code and so on) which one of different predifined advertisements are put into each eMail, text or HTML. So all "active" users can get an advertisement for a paied VIP-Account, all inactive users can be invited to get more active, all new users can get some hints for special funktions/hacks in the forums and so on.
For this all, working fine, I would immediate donate 150$ for the programmer. Somebody else also?
Best wishes, Julian!
grandeur_69
10-30-2006, 05:03 PM
search for commbull ... you'll find what you are looking for and then some.
farukcan
11-04-2006, 10:17 PM
this hack run a wtih 3.6.x???
grandeur_69
11-06-2006, 09:11 PM
no, but the commercial one does.
Steve Kish
11-08-2006, 05:26 PM
Great job - works! Is there anyway to make all post notification emails HTML as well?
Shazz
11-25-2006, 03:50 PM
/me testing installed
criscokid
11-28-2006, 10:15 AM
Are there rules we are supposed to follow on how to write the mails? Only certain tags supported? I entered HTML as though it was a web-page (with <head> and <body> and everything)!
Have a read of this HTML email design document (http://www.mailchimp.com/resources/html_email_design.pdf) - especially the section titled 'Testing & Troubleshooting Your Email Designs'.
criscokid
11-28-2006, 10:19 AM
Am I right in assuming this mod doesn't send email using the Multipart/Alternative MIME format? - there's no facility to include a plain-text alternative version of the email.
More on this format:
"You need to send HTML email from your server in Multipart-Alternative MIME format. Basically, that means your mail transfer agent bundles your HTML code, PLUS a plain-text version of the message, together into one email. That way, if a recipient cant view your beautiful HTML email, the good-oldfashioned plain-text version of your message is auto-magically displayed. Its kind of a nerdy gobbledy-geek thing, which is why a lot of people mess things up when they try to send HTML email themselves. You either need to program a script to send email in multipart/alternative MIME format, or just use an outside vendor to deliver things for you."
ThunderWolf
01-08-2007, 04:01 PM
Thank you soooooooooooo much, I was lokking for it for along time.
I tried it on ver. 3.6.2 and worked very well.
For those who can't find the code :
construct_hidden_code('test', $vbulletin->GPC['test']);
try to find it by yourself ((DO NOT USE FIND OR SEARCH))
Regards,
ThunderWolf
AFemaleProdigy
01-09-2007, 04:42 PM
Just wanted to let you know that I have installed this on VB 3.6.4 and it works great. Really easy to install and use! Thanks so much! :D
Scamorz
01-17-2007, 12:24 PM
Yes, it works great on 3.6.4 !
THANKS!!!
AHMUDEM
01-20-2007, 11:58 PM
Thanks man
rex_b
01-21-2007, 08:05 PM
thanks for the update... I love this!
GreysAnatomy
01-23-2007, 08:20 AM
Installed this, took me like 2min. and it's working great on 3.6.4, thank you! You're a genius!
arena
01-23-2007, 07:43 PM
Works for: 3.6.4?
Evil Chris
02-02-2007, 02:32 PM
thanks.... installed.
FamilyCorner
07-30-2007, 11:13 AM
I have to admit that I am a little nervous about installing this. I had installed a previous hack similar to this that is now in the "graveyard" of this forum because it is no longer supported. I had two problems with that one:
-- if someone was set to plain text, when they received the newsletter all they saw was raw html.
-- I had to create the newsletter in raw html as there was no WYSIWYG type editor to create it with.
Would anyone be willing to share their experience with me regarding the above two points? Or even allow me to register at your forums and then send me an HTML newsletter twice, once with me set to plain text and once to HTML?
Thanks!
PoetJA-1975
09-03-2007, 01:51 AM
Just tested - works on 3.6.8
Thanx again for the sharing ;)
Jacquii.
massizero
05-04-2008, 07:18 AM
works on 3.7?
thanks
princeedward
07-11-2008, 09:02 AM
Test Email Only?
(Will not send any email out)
well - I don't think you would receive them - they're TEST emails right?
test it by sending just to ADMIN user group - test email only set to no.
Jacquii.
ps - works like a charm ;)i used to test this method...but not workin....can you be more specific please here...or anyone who can make this clear...
al l i want is to test email myself (admin).....but no luck
thanks and appreciate any help here
best regards to all...
:rolleyes:
PoetJA-1975
07-12-2008, 11:18 AM
Actually - make sure Send HTML Email? is selected as Yes.
In the User Name formfield - simply input your username.
Make sure Test Email Only? is selected as No.
Jacquii.
princeedward
07-12-2008, 09:55 PM
Actually - make sure Send HTML Email? is selected as Yes.
In the User Name formfield - simply input your username.
Make sure Test Email Only? is selected as No.
Jacquii.thanks for your quick reply/assistance...Jacquii, appreciate it...but still not good...got error like this...
No Users Matched Your Query
EDIT: okay...finally i got it now...it's working...i just click
Include users that have declined admin emails? (Yes ):up:
PoetJA-1975
07-13-2008, 12:02 AM
LOL - Glad you figured it out ;)
Jacquii.
Javierogo
02-14-2009, 12:16 AM
Beautiful modification! Thanks ;)
adpar
06-24-2009, 10:42 AM
I have a paid campaign and I need to send and html email to my 9.000 members, today. (yes today... :-( )
(i thought I would be able to do it in an easy manner but ofcourse there is none)
our technitians tried to use this mod with the latest version ( 3.8) but it seems it s incompatible???
is there another way to send html ????
PLEASE PLEASE help!
fixened
06-24-2010, 12:12 PM
Good ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.