PDA

View Full Version : Send HTML email via admincp


Dean C
11-22-2004, 10:00 PM
[Send HTML email via admincp]

Information

vBulletin Version: 3.0.3


Author: Dean Clatworthy (http://www.deanclatworthy.com)


Copyright: You may use this modification at your own risk. I cannot and will not be held responsible for any damage you may cause to your forums during installation or thereafter. You may not distribute this modification in whole or parts and anyone found doing so faces risk of prosecution. All my modifications are released at vBulletin.org and anyone found releasing them elsewhere also faces risk of prosecution. You may not translate this modification without my prior permission.


Donations: I release my modifications for free. If you wish to donate please contact me via PM and I will give you my details. All donations are graciously appreciated.


Credits: I would like to thank the following people who contributed to the making of this modification.

Breaker - for bugging me on IRC how to do it.



What does this modification do?
This modification allows you to send optional HTML email in your newsletter when mass emailing users from your AdminCP

Installation

1/

In admincp/email.php find:


vbmail($user['email'], $_POST['subject'], $sendmessage, true, $_POST['from']);


Replace it with:

if($_POST['sendhtml'])
{
vbmail($user['email'], $_POST['subject'], $sendmessage, true, $_POST['from'], '', '', true);
}
else
{
vbmail($user['email'], $_POST['subject'], $sendmessage, true, $_POST['from']);
}


2/

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);


3/

In admincp/email.php find:


construct_hidden_code('test', $_POST['test']);


Directly below it place:

construct_hidden_code('sendhtml', $_POST['sendhtml']);


4/

In includes/functions.php find:


function vbmail($toemail, $subject, $message, $notsubscription = false, $from = '' , $uheaders = '', $username = '')


Replace it with:

function vbmail($toemail, $subject, $message, $notsubscription = false, $from = '' , $uheaders = '', $username = '', $html = false)


5/

In includes/functions.php find:


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


Replace it with:

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


Please Click Install!
If you installed this modifcation please click the install button. It'll help you keep up to date with future releases and important bugfixes, security updates.

Dan
11-23-2004, 07:58 PM
Awsome Hack Dean :D thanks!

Chris M
11-23-2004, 08:02 PM
Nice - Adding to my "to install" list :)

Satan

Royal
11-23-2004, 08:03 PM
Cool addon Dean :)

* Royal clicks install

Breaker
11-23-2004, 09:29 PM
thanks for this one Dean, helped me alot especially when you told me how to get it so normal emails woldn't be effected :)

* Breaker installed it first :)

pirrup
11-24-2004, 05:31 AM
tnx for sharing
/me clicks install

Floris
11-24-2004, 11:00 AM
Can members select to receive plain or html emails?

GamerzWorld
11-24-2004, 11:31 AM
Any screenes of what it looks like in admincp?

FleaBag
11-24-2004, 01:25 PM
Been wanting this one for a while, I could do it in vB2 with a little CSS, didn't seem to want to work in vB3. Thanks again!

razor69
11-24-2004, 02:18 PM
What am I missing? I did the install, and there is no where to include the message in admincp now? What am I doing wrong?

HiDeo
11-24-2004, 02:32 PM
Nice job thanks !

Breaker
11-24-2004, 02:50 PM
i tihnk step 2 is wrong....not sure though. Dean, did you actually test it with the yes/no boxes?

Dean C
11-24-2004, 03:11 PM
Can members select to receive plain or html emails?

Nope :)

Dean C
11-24-2004, 03:14 PM
Any screenes of what it looks like in admincp?

Screenshot now attached to first post, nothing much to see though :)

Dean C
11-24-2004, 03:15 PM
What am I missing? I did the install, and there is no where to include the message in admincp now? What am I doing wrong?

Fixed. Minor typo in the instructions. Please re-apply step 2 again.

deathemperor
11-25-2004, 05:53 AM
exactly what I wanted to ask, thanks

but I do need a txt instruction...

Princeton
11-25-2004, 12:27 PM
Excellent and usable hack!!

Thanks for sharing. Clicks install. :)

PS. Why is the text so small on first post? It's hard to read at 1600 resolution. :(

Breaker
11-25-2004, 02:59 PM
Fixed. Minor typo in the instructions. Please re-apply step 2 again.
thought that was the issue myself, but i didn't want to say it directly. I did say there was a problem with step 2 though :P

Dean C
11-25-2004, 03:22 PM
PS. Why is the text so small on first post? It's hard to read at 1600 resolution. :(

I like 10px font :)

mcyates
11-27-2004, 10:09 AM
PROBLEM!!!!!

My forum is set to send 500 emails at a time, it works fine for the first 500 emails as i'm the admin and i got it in HTML. When it starts the 500 > 700 members (i have 700 members) it sends it in normat text and not html as i have a second account which it sent it to and it was all messed up html code.

Dean C
11-27-2004, 10:32 AM
PROBLEM!!!!!

My forum is set to send 500 emails at a time, it works fine for the first 500 emails as i'm the admin and i got it in HTML. When it starts the 500 > 700 members (i have 700 members) it sends it in normat text and not html as i have a second account which it sent it to and it was all messed up html code.

Ah of course, I've added a new step. Please apply step 3 and all should work fine now :)

mcyates
11-27-2004, 10:42 AM
Ah of course, I've added a new step. Please apply step 3 and all should work fine now :)
ok thank you very much.

Dean C
11-27-2004, 11:03 AM
ok thank you very much.

You're welcome - let me know if you get any other problems :)

Cornolio
12-05-2004, 01:18 PM
i get this error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /web/htdocs/www.discutere.it/home/includes/functions.php on line 1888
:confused:

Dean C
12-05-2004, 01:44 PM
Then you applied the modification wrong. Go back and reapply it :)

cinq
12-05-2004, 02:11 PM
Fantastic, I was just asking over at vb.com on how I could send out nicely HTML Formatted emails to my members, could be great as a newsletter thingy.

Thanks a million Dean ! :D

Cornolio
12-05-2004, 02:46 PM
Then you applied the modification wrong. Go back and reapply it :)
i've already reapplyied twice :cry:
i'm going to reapply another time but... it doesn't have conflicts with vbchat, right?

Dean C
12-05-2004, 03:25 PM
I can't see why it would Cornholio. Are you using dreamweaver to apply the modification? DW screws up formatting a lot and it could be that perhaps?

Cornolio
12-05-2004, 03:50 PM
yes, i was using dw... i've just modified the files with wordpad and it worked :D

thanks :D

Dean C
12-05-2004, 03:55 PM
Glad you got it working ;)

paulyy
12-06-2004, 08:35 PM
Nice!!

* paulyy clicks install

By the way, for future reference DreamWeaver tends to screw up this line;

$debughtml .= " (<a href=\"" . htmlspecialchars_uni(SCRIPTPATH) . iif(strpos(SCRIPTPATH, '?') === false, '?', '&amp;') . "tempusage=1\">Template Usage</a>) (<a href=\"" .

mtha
12-08-2004, 06:07 PM
:( hmm, somehow I didnt get this to work.

I applied this hack, and go to AdminCP

If I send email as plain text, it go though
If I send email as html, I dont get the email. (it said mail sent successfully in ACP)

Do you have any idea why I cant receive html email?

Dean C
12-09-2004, 05:52 PM
:( hmm, somehow I didnt get this to work.

I applied this hack, and go to AdminCP

If I send email as plain text, it go though
If I send email as html, I dont get the email. (it said mail sent successfully in ACP)

Do you have any idea why I cant receive html email?

Do any of your members get the HTML email?

mtha
12-10-2004, 01:01 AM
Do you have any idea why I cant receive html email?

I sent one test html email to myself, didnt send to others :)

maybe I should do some more tests, (at later time)

primesuspect
12-14-2004, 01:57 AM
Thanks for this hack! I appreciate it!

deathemperor
12-29-2004, 03:10 AM
but I do need a txt instruction...
why not ?

Dean C
01-03-2005, 10:54 AM
The modification is here if you want it. I'm not creating txt files for private reasons :)

SnowBot
01-03-2005, 12:09 PM
Great little hach Dean :)

* SnowBot clicks install

I have abit of catching up to do with hacks as been away for afew weeks :)

wolfgang2
01-18-2005, 01:52 PM
Great little hach Dean :)

* SnowBot clicks install

I have abit of catching up to do with hacks as been away for afew weeks :)
is it working with vB 3.0.5?
if yes i click install....

Dean C
01-20-2005, 08:49 PM
It should do, give it a try :)

yoyoyoyo
01-20-2005, 09:57 PM
is it working with vB 3.0.5?
if yes i click install....
it sure is! :D

wolfgang2
01-21-2005, 12:48 AM
it sure is! :D
i'll try it with 3.0.6 now:)

Muderman24
01-23-2005, 09:29 PM
i don't have any of the code so what do i do?

Dean C
01-24-2005, 01:51 PM
Huh? What do you mean?

Muderman24
01-24-2005, 03:15 PM
the code in the first step thats should be in admincp/email.php i tried to find that code and it's no there.

Muderman24
01-24-2005, 04:15 PM
nvm i got it i don't know why it wasn't finding it but it works now, nice work.

renee1
01-31-2005, 08:21 PM
will this work on 3.05?

Dean C
02-03-2005, 03:41 PM
will this work on 3.05?

It should do :)

puchko
02-03-2005, 09:07 PM
Thanks for the mod.

Just wondering if there is a way to auto-detect if the user can receive html or plain text email, and then the email is sent in the appropriate format...

ArBoK
02-04-2005, 01:37 PM
Thanks for the mod.

Just wondering if there is a way to auto-detect if the user can receive html or plain text email, and then the email is sent in the appropriate format...


yeah i wonder if there's some way to do that, not all users may be able to receive HTML :rolleyes:

jribz
02-05-2005, 03:08 PM
Thanks for the mod.

Just wondering if there is a way to auto-detect if the user can receive html or plain text email, and then the email is sent in the appropriate format...I don't think there is any way of detecting that, it's not even an option in VB when you register so how would you know?

Unless, of course you're meaning to send plain and html at the same time and detect at the opening level, but I'm not sure that can be done either. :rolleyes:

Dean C
02-06-2005, 10:57 AM
You could add a profile field where a user can set whether to receieve HTML/text email :) I'll look into it when I have some free time

uae-style
02-07-2005, 02:45 AM
didnt work on 3.0.6 :(

uae-style
02-07-2005, 02:50 AM
it worked
i was uploading my backup files by mistake LOOOOOOOOOOOOOOOOOOOOOOOL
thanx man 4 the great hack ;)

sicloan
02-10-2005, 09:41 PM
awsome hack, i really needed this !!

renee1
02-11-2005, 12:43 PM
Dean you ROCK!!!! it works great!

Dean C
02-21-2005, 04:34 PM
Glad it's working for you guys :)

primesuspect
03-04-2005, 02:04 AM
Just a note: for some reason when you cut and paste the code from here to EditPlus for windows, it butchers this section:

if($_POST['sendhtml'])
{
vbmail($user['email'], $_POST['subject'], $sendmessage, true, $_POST['from'], '', '', true);
}
else
{
vbmail($user['email'], $_POST['subject'], $sendmessage, true, $_POST['from']);
}

not sure why. Just a heads up if this is driving anyone nuts who uses EditPlus like I do. I typed it in by hand and it works fine. Cheers! :)

armagan
03-17-2005, 04:41 AM
will this work on 3.07?

lange
03-21-2005, 03:26 AM
bump

Marco van Herwaarden
03-21-2005, 03:38 AM
What are you bumping for lange? I don't see a previous question from you.

lange
03-21-2005, 04:28 AM
...Will this work on 3.07?

[t4e]Kicks
03-23-2005, 01:30 PM
This mod looks interesting. My question is whether or not you can tell it to send to only certain user groups. I run a World of Warcraft guild forum and want it to only be sent to select groups, but not all of the users. Thanks in advance for your response

Breaker
03-23-2005, 01:34 PM
Kicks']This mod looks interesting. My question is whether or not you can tell it to send to only certain user groups. I run a World of Warcraft guild forum and want it to only be sent to select groups, but not all of the users. Thanks in advance for your response
this just adds an extra option to the current email option in vB.... so you can make it only send the mail to certain usergroups



@lange : should work on 3.0.7 nothing has really changed

[t4e]Kicks
03-23-2005, 03:30 PM
Kicks]well, duh

I'll be alright :)

fishkorp
03-25-2005, 01:18 AM
thanks, installed and works great....with one exception. if i send out an email with images or tables it gets sent to people's spam folders. anyone know a away around this?

Cahlutz
04-01-2005, 04:54 PM
Hello,

I've just tried to add this hack but it seems i can't edti includes/function.php
I can't understand why. If i change only one letter in it, then put it back it gives me the same error over and over. I even started a ssh session on server and edit the file through PICO, same error. Whitout editing the file i can't see the forum until i upload the original file again.

Can someone help me on this?

Norbert
04-08-2005, 08:42 PM
Perfect thx for this real great modification!

Liebe GrĂ¼sse aus Wien,
Norbert

T3MEDIA
04-11-2005, 05:49 AM
I did a mass PM of 18,000 and I #15340 didnt get it.

I was testing to myself and it worked like a charm.

Any ideas why?

knetgummi
04-11-2005, 01:54 PM
>>>installed<<<
nice hack, thank u very much :)


greetZ
knetgummi

BradM
04-11-2005, 06:27 PM
I installed and tested, I am not receiving HTML emails at all. The emails just never arrive?

Marco van Herwaarden
04-11-2005, 09:10 PM
I installed and tested, I am not receiving HTML emails at all. The emails just never arrive?Check your Junk Mail (or what ever it is called) folder. A lot of over active spam filters treat html mails as spam.

htscpl
05-06-2005, 03:44 AM
I just installed and tested, receive html email to myself! This is just what I've been looking for! Thanks !

** Clicks Install **

DannyITR
05-18-2005, 03:26 PM
After uploading the two files my forums shut down and I get this error:


Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home2/montreal/public_html/forums/includes/functions.php on line 2019

If I replace functions.php with the old one it goes away.

this is line 2019:

$debughtml .= " (<a href=\"" . htmlspecialchars_uni(SCRIPTPATH) . iif(strpos(SCRIPTPATH, '?') '?')=== false, '?', '?','&amp;') . "tempusage=1\">Template Usage</a>) (<a href=\"" . htmlspecialchars_uni(SCRIPTPATH) . iif(strpos(SCRIPTPATH, '?') '?')=== false, '?', '?','&amp;') . "explain=1\">Explain</a>)<br />\n";
$debughtml .= "<select>\n\t<option>(Page Generated in $totaltime Seconds)</option>\n$messages</select>\n";

ry@n
05-20-2005, 01:05 AM
nice hack.

helped alot.

DannyITR
05-23-2005, 02:00 PM
Help!!!!!!

Dean C
06-05-2005, 01:16 PM
After uploading the two files my forums shut down and I get this error:


Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home2/montreal/public_html/forums/includes/functions.php on line 2019

If I replace functions.php with the old one it goes away.

this is line 2019:

You are applying the changes incorrectly

ZGeek
07-14-2005, 11:00 PM
is there a way to make it that all emails sent out are in html format?

ZGeek
07-15-2005, 01:28 AM
I figured it out, don't even need this hack. i just changed the line in the included/functions.php from

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

to

$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter; I hope this helps anyone looking for html emails.

edbri871
07-20-2005, 10:45 PM
Thanks, this hack has helped me a lot. :)

SCI
07-27-2005, 05:41 PM
Thanks for the Hack! I didnt test it yet but The modification went well in 3.0.7

jellybaby
08-23-2005, 11:51 AM
Is this no longer available, or is there an updated version anywhere? :ermm:

skizzy203
10-12-2005, 05:30 PM
I was hoping that you could enlighten us with useful information on how to send HTML formated e-mail through vBulletin 3.5.

I use this and would like to see it integrated.

B999V
10-12-2005, 09:54 PM
I was hoping that you could enlighten us with useful information on how to send HTML formated e-mail through vBulletin 3.5.

I use this and would like to see it integrated.

That would be very nice.

chapsrulez
10-21-2005, 03:47 AM
installed and fully working
thanks.

dlittle
11-18-2005, 10:35 AM
(Using 3.5.0) I had to do an HTML mailout yestuday, and had to hack a line to get it to go...

In includes/class_mail.php:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Change the obvious to:
$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Something more elegant may come around, but that was my quick fix.

dutchbb
12-02-2005, 03:04 PM
(Using 3.5.0) I had to do an HTML mailout yestuday, and had to hack a line to get it to go...

In includes/class_mail.php:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Change the obvious to:
$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Something more elegant may come around, but that was my quick fix.
Is that the only edit that needs to be done to the orig. vb 3.5.1 files?

Or do I still need to apply the edits from dean's first post?

thanks,
T.

xBhp
12-25-2005, 02:38 PM
will this work in 3.5.2?

MissKalunji
01-02-2006, 04:08 AM
(Using 3.5.0) I had to do an HTML mailout yestuday, and had to hack a line to get it to go...

In includes/class_mail.php:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Change the obvious to:
$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Something more elegant may come around, but that was my quick fix.

works great thanks!

Gizmo999
02-01-2006, 07:38 PM
Does it have any effect on the normal admin/registration emails??

MissKalunji
02-01-2006, 08:18 PM
Does it have any effect on the normal admin/registration emails??

yes it does

demojames
02-15-2006, 06:55 PM
Works perfectly on 3.0.12. Great Job Thanks!!

texasasl
02-21-2006, 10:38 AM
I installed it in version 3.5.2 but in the functions.php i didn't find the 5th step....The new layout works but still no HTML coding.... :(

Any ideas plz??

texasasl
02-21-2006, 11:41 AM
(Using 3.5.0) I had to do an HTML mailout yestuday, and had to hack a line to get it to go...

In includes/class_mail.php:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Change the obvious to:
$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Something more elegant may come around, but that was my quick fix.
Using this code i don't even get an email...I'm testing it all day long...Any ideas??

VB V.3.5.2

masterross
03-19-2006, 06:56 PM
(Using 3.5.0) I had to do an HTML mailout yestuday, and had to hack a line to get it to go...

In includes/class_mail.php:
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Change the obvious to:
$headers .= 'Content-Type: text/html' . iif($encoding, "; charset=\"$encoding\"") . $delimiter;

Something more elegant may come around, but that was my quick fix.

the problem is that all mails are senging as HTML
and this hack not works on 3.5.x couse choise "use HTML" are not send to functions.... dont know why...
even i set
construct_hidden_code('sendhtml', $vbulletin->GPC['sendhtml']);

BR,
Ross

masterross
03-19-2006, 11:02 PM
i've just found this:
https://vborg.vbsupport.ru/showthread.php?t=99910

and works ok

BR

zeropaid
05-11-2006, 07:29 PM
Any idea if this will work in 3.5?

coffee
09-12-2006, 02:04 PM
Dean, Could you please upgrade this to 3.6 using plugin and hooks?

marlita
10-09-2006, 01:15 PM
Can this work for 3.6.x?

webmaster74
08-17-2007, 08:52 PM
ok..... so the coder is not any more supporting the mod. let us look for something similar.

Filmkolik
08-27-2008, 01:23 PM
Forumlarda arayıpta bulamadıgımda buydu :) sonunda kavuştum thanks

feremerz
09-20-2008, 06:08 PM
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"$encoding\"") . $delimiter; this line not founded