FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,74 @@
<h3>Change Log Summary</h3>
<p>-- <em>(Note: See the <a href="http://drupalcode.org/project/htmlmail.git/log/refs/heads/7.x-2.x">git repository</a> for full version)</em></p>
<dl>
<dt>November 4, 2008</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/64a69aff375ffe42d311963d748866085281896e">HTML Mail created</a> by <a href="http://drupal.org/user/1171">Chris Herberte</a>.</p>
</dd>
<dt>July 19, 2009</dt>
<dd>
<p><a href="http://drupal.org/node/524718">5.x-1.1</a> released <em>(288 <a href="http://www.dwheeler.com/sloccount/">SLOC</a>, 60k)</em> as an improved replacement for <a href="http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_mail/5"><code>drupal_mail()</code></a>.</p>
</dd>
<dt>February 26, 2010</dt>
<dd>
<p><a href="http://drupal.org/node/726398">6.x-1.3</a> released <em>(348 <a href="http://www.dwheeler.com/sloccount/">SLOC</a>, 108k)</em> and eventually installed by <a href="http://drupal.org/project/usage/726398">over 5,000 sites</a>.</p>
</dd>
<dt>January 1, 2011</dt>
<dd>
<p><a href="http://drupal.org/node/1012246">Patches to improve theming</a> of the <a href="http://drupal.org/node/355250">7.x-1.x-dev version</a> submitted by <a href="http://drupal.org/user/36148">Bob Vincent (pillarsdotnet)</a>.</p>
</dd>
<dt>March 10, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/mailsystem.git/commit/5cc8201c5e48b56efecc139c9a51dd49775aebaf">Mail System created</a> to allow mail-sending modules to cooperate and co-exist.</p>
</dd>
<dt>March 11, 2011</dt>
<dd>
<p><a href="http://drupal.org/user/36148">Bob Vincent</a> granted co-maintainer access.</p>
</dd>
<dd>
<p><a href="http://drupal.org/node/1088882">7.x-1.1</a> released <em>(589 <a href="http://www.dwheeler.com/sloccount/">SLOC</a>, 76k)</em>.</p>
</dd>
<dt>March 16, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/a0083eea7b575a702d3aecdd0578378277c7c8d4">Emogrifier separated</a> into <a href="http://drupal.org/project/emogrifier">its own module</a>.</p>
</dd>
<dt>March 18, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/6c0463849493f8b528be8d4099ab0c6fbc976fe2">7.x-2.x</a> and <a href="http://drupalcode.org/project/htmlmail.git/commit/a4b36c6de5f241ceccd0aeea4599d35de066fa9c">6.x-2.x</a> branches created.</p>
</dd>
<dt>March 20, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/f481fc8997a1345e9490e80043c616a5805d6e44">Echo separated</a> into <a href="http://drupal.org/project/echo">its own module</a>.</p>
</dd>
<dt>March 25, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/0ebec6e83e688b6d51e35554618727dc3133c970">MIME capability added</a>.</p>
</dd>
<dt>March 26, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/104e8916c9ba92486a227786b6781cac38e60905">MIME support delegated</a> to <a href="http://pear.php.net">PEAR</a> <a href="http://pear.php.net/manual/en/package.mail.mail-mimepart.mail-mimepart.php">Mail_mimePart</a> and <a href="http://pear.php.net/manual/en/package.mail.mail-mimedecode.php">Mail_mimeDecode</a> classes.</p>
</dd>
<dt>April 3, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/a17e7996d0d119012205cf47195064848e59d937">Mime support separated</a> into <a href="http://drupal.org/project/mailmime">its own module</a>.</p>
</dd>
<dt>April 4, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/f419fb3cf18276cca9f0d3dbc2c80e6e6a6bbda9">7.x-2.x changes backported to 6.x-2.x</a>.</p>
</dd>
<dt>April 6, 2011</dt>
<dd>
<p><a href="http://drupal.org/node/1118032">6.x-2.4</a> <em>(420 <a href="http://www.dwheeler.com/sloccount">SLOC</a>, 92k)</em> and <a href="http://drupal.org/node/1118034">7.x-2.4</a> <em>(414 <a href="http://www.dwheeler.com/sloccount">SLOC</a>, 92k)</em> released.</p>
</dd>
<dd>
<p><a href="http://drupal.org/project/htmlmail">Project page</a> updated to remove support for <a href="http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/6.x-1.x">6.x-1.x</a> and <a href="http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/7.x-1.x">7.x-1.x</a> branches.</p>
</dd>
<dt>April 7, 2011</dt>
<dd>
<p>Dependency on <a href="http://drupal.org/project/echo">Echo</a> and <a href="http://drupal.org/project/mailmime">Mail MIME</a> modules <a href="http://drupalcode.org/project/htmlmail.git/commit/20abfd24ad0006c9312fd8f0a5edcdaed8e5920b">removed</a>.</p>
</dd>
<dt>April 9, 2011</dt>
<dd>
<p><a href="http://drupalcode.org/project/htmlmail.git/commit/dd53d4f28cdbe893bb32e31a03ceba34c5240402">Autodetection of template files</a> in both module and selected theme directories.</p>
</dd>
</dl>

View File

@@ -0,0 +1,71 @@
### Change Log Summary
-- *(Note: See the [git repository](http://drupalcode.org/project/htmlmail.git/log/refs/heads/7.x-2.x) for full version)*
November 4, 2008
: [HTML Mail created](http://drupalcode.org/project/htmlmail.git/commit/64a69aff375ffe42d311963d748866085281896e) by [Chris Herberte](http://drupal.org/user/1171).
July 19, 2009
: [5.x-1.1](http://drupal.org/node/524718) released *(288 [SLOC](http://www.dwheeler.com/sloccount/), 60k)* as an improved replacement for [`drupal_mail()`](http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_mail/5).
February 26, 2010
: [6.x-1.3](http://drupal.org/node/726398) released *(348 [SLOC](http://www.dwheeler.com/sloccount/), 108k)* and eventually installed by [over 5,000 sites](http://drupal.org/project/usage/726398).
January 1, 2011
: [Patches to improve theming](http://drupal.org/node/1012246) of the [7.x-1.x-dev version](http://drupal.org/node/355250) submitted by [Bob Vincent (pillarsdotnet)](http://drupal.org/user/36148).
March 10, 2011
: [Mail System created](http://drupalcode.org/project/mailsystem.git/commit/5cc8201c5e48b56efecc139c9a51dd49775aebaf) to allow mail-sending modules to cooperate and co-exist.
March 11, 2011
: [Bob Vincent](http://drupal.org/user/36148) granted co-maintainer access.
: [7.x-1.1](http://drupal.org/node/1088882) released *(589 [SLOC](http://www.dwheeler.com/sloccount/), 76k)*.
March 16, 2011
: [Emogrifier separated](http://drupalcode.org/project/htmlmail.git/commit/a0083eea7b575a702d3aecdd0578378277c7c8d4) into [its own module](http://drupal.org/project/emogrifier).
March 18, 2011
: [7.x-2.x](http://drupalcode.org/project/htmlmail.git/commit/6c0463849493f8b528be8d4099ab0c6fbc976fe2) and [6.x-2.x](http://drupalcode.org/project/htmlmail.git/commit/a4b36c6de5f241ceccd0aeea4599d35de066fa9c) branches created.
March 20, 2011
: [Echo separated](http://drupalcode.org/project/htmlmail.git/commit/f481fc8997a1345e9490e80043c616a5805d6e44) into [its own module](http://drupal.org/project/echo).
March 25, 2011
: [MIME capability added](http://drupalcode.org/project/htmlmail.git/commit/0ebec6e83e688b6d51e35554618727dc3133c970).
March 26, 2011
: [MIME support delegated](http://drupalcode.org/project/htmlmail.git/commit/104e8916c9ba92486a227786b6781cac38e60905) to [PEAR](http://pear.php.net) [Mail_mimePart](http://pear.php.net/manual/en/package.mail.mail-mimepart.mail-mimepart.php) and [Mail_mimeDecode](http://pear.php.net/manual/en/package.mail.mail-mimedecode.php) classes.
April 3, 2011
: [Mime support separated](http://drupalcode.org/project/htmlmail.git/commit/a17e7996d0d119012205cf47195064848e59d937) into [its own module](http://drupal.org/project/mailmime).
April 4, 2011
: [7.x-2.x changes backported to 6.x-2.x](http://drupalcode.org/project/htmlmail.git/commit/f419fb3cf18276cca9f0d3dbc2c80e6e6a6bbda9).
April 6, 2011
: [6.x-2.4](http://drupal.org/node/1118032) *(420 [SLOC](http://www.dwheeler.com/sloccount), 92k)* and [7.x-2.4](http://drupal.org/node/1118034) *(414 [SLOC](http://www.dwheeler.com/sloccount), 92k)* released.
: [Project page](http://drupal.org/project/htmlmail) updated to remove support for [6.x-1.x](http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/6.x-1.x) and [7.x-1.x](http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/7.x-1.x) branches.
April 7, 2011
: Dependency on [Echo](http://drupal.org/project/echo) and [Mail MIME](http://drupal.org/project/mailmime) modules [removed](http://drupalcode.org/project/htmlmail.git/commit/20abfd24ad0006c9312fd8f0a5edcdaed8e5920b).
April 9, 2011
: [Autodetection of template files](http://drupalcode.org/project/htmlmail.git/commit/dd53d4f28cdbe893bb32e31a03ceba34c5240402) in both module and selected theme directories.

View File

@@ -0,0 +1,107 @@
Change Log Summary
-- (Note: See the [1]git repository for full version)
November 4, 2008
[2]HTML Mail created by [3]Chris Herberte.
July 19, 2009
[4]5.x-1.1 released (288 [5]SLOC, 60k) as an improved
replacement for [6]drupal_mail().
February 26, 2010
[7]6.x-1.3 released (348 [8]SLOC, 108k) and eventually installed
by [9]over 5,000 sites.
January 1, 2011
[10]Patches to improve theming of the [11]7.x-1.x-dev version
submitted by [12]Bob Vincent (pillarsdotnet).
March 10, 2011
[13]Mail System created to allow mail-sending modules to
cooperate and co-exist.
March 11, 2011
[14]Bob Vincent granted co-maintainer access.
[15]7.x-1.1 released (589 [16]SLOC, 76k).
March 16, 2011
[17]Emogrifier separated into [18]its own module.
March 18, 2011
[19]7.x-2.x and [20]6.x-2.x branches created.
March 20, 2011
[21]Echo separated into [22]its own module.
March 25, 2011
[23]MIME capability added.
March 26, 2011
[24]MIME support delegated to [25]PEAR [26]Mail_mimePart and
[27]Mail_mimeDecode classes.
April 3, 2011
[28]Mime support separated into [29]its own module.
April 4, 2011
[30]7.x-2.x changes backported to 6.x-2.x.
April 6, 2011
[31]6.x-2.4 (420 [32]SLOC, 92k) and [33]7.x-2.4 (414 [34]SLOC,
92k) released.
[35]Project page updated to remove support for [36]6.x-1.x and
[37]7.x-1.x branches.
April 7, 2011
Dependency on [38]Echo and [39]Mail MIME modules [40]removed.
April 9, 2011
[41]Autodetection of template files in both module and selected
theme directories.
References
1. http://drupalcode.org/project/htmlmail.git/log/refs/heads/7.x-2.x
2. http://drupalcode.org/project/htmlmail.git/commit/64a69aff375ffe42d311963d748866085281896e
3. http://drupal.org/user/1171
4. http://drupal.org/node/524718
5. http://www.dwheeler.com/sloccount/
6. http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_mail/5
7. http://drupal.org/node/726398
8. http://www.dwheeler.com/sloccount/
9. http://drupal.org/project/usage/726398
10. http://drupal.org/node/1012246
11. http://drupal.org/node/355250
12. http://drupal.org/user/36148
13. http://drupalcode.org/project/mailsystem.git/commit/5cc8201c5e48b56efecc139c9a51dd49775aebaf
14. http://drupal.org/user/36148
15. http://drupal.org/node/1088882
16. http://www.dwheeler.com/sloccount/
17. http://drupalcode.org/project/htmlmail.git/commit/a0083eea7b575a702d3aecdd0578378277c7c8d4
18. http://drupal.org/project/emogrifier
19. http://drupalcode.org/project/htmlmail.git/commit/6c0463849493f8b528be8d4099ab0c6fbc976fe2
20. http://drupalcode.org/project/htmlmail.git/commit/a4b36c6de5f241ceccd0aeea4599d35de066fa9c
21. http://drupalcode.org/project/htmlmail.git/commit/f481fc8997a1345e9490e80043c616a5805d6e44
22. http://drupal.org/project/echo
23. http://drupalcode.org/project/htmlmail.git/commit/0ebec6e83e688b6d51e35554618727dc3133c970
24. http://drupalcode.org/project/htmlmail.git/commit/104e8916c9ba92486a227786b6781cac38e60905
25. http://pear.php.net/
26. http://pear.php.net/manual/en/package.mail.mail-mimepart.mail-mimepart.php
27. http://pear.php.net/manual/en/package.mail.mail-mimedecode.php
28. http://drupalcode.org/project/htmlmail.git/commit/a17e7996d0d119012205cf47195064848e59d937
29. http://drupal.org/project/mailmime
30. http://drupalcode.org/project/htmlmail.git/commit/f419fb3cf18276cca9f0d3dbc2c80e6e6a6bbda9
31. http://drupal.org/node/1118032
32. http://www.dwheeler.com/sloccount
33. http://drupal.org/node/1118034
34. http://www.dwheeler.com/sloccount
35. http://drupal.org/project/htmlmail
36. http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/6.x-1.x
37. http://drupalcode.org/project/htmlmail.git/shortlog/refs/heads/7.x-1.x
38. http://drupal.org/project/echo
39. http://drupal.org/project/mailmime
40. http://drupalcode.org/project/htmlmail.git/commit/20abfd24ad0006c9312fd8f0a5edcdaed8e5920b
41. http://drupalcode.org/project/htmlmail.git/commit/dd53d4f28cdbe893bb32e31a03ceba34c5240402

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,183 @@
<h2><a href="http://drupal.org/project/htmlmail">HTML Mail</a></h2>
<p>Lets you theme your messages the same way you theme the rest of your website.</p>
<h3><a href="http://www.dict.org/bin/Dict?Form=Dict2&amp;Database=*&amp;Query=requirement">Requirement</a></h3>
<ul>
<li><a href="http://drupal.org/project/mailsystem">Mail System 7.x-2.x</a></li>
</ul>
<h3><a href="http://drupal.org/documentation/install/modules-themes/modules-7">Installation</a></h3>
<p>The following additional modules, while not required, are highly recommended:</p>
<ul>
<li>
<dl>
<dt><a href="http://drupal.org/project/echo">Echo</a></dt>
<dd>Wraps your messages in a drupal theme. Now you can "brand" your messages with the same logo, header, fonts, and styles as your website.</dd>
</dl>
</li>
<li>
<dl>
<dt><a href="http://drupal.org/project/emogrifier">Emogrifier</a></dt>
<dd>Converts stylesheets to inline style rules, for consistent display on mobile devices and webmail.</dd>
</dl>
</li>
<li>
<dl>
<dt><a href="http://drupal.org/project/mailmime">Mail MIME</a></dt>
<dd>Provides a text/plain alternative to text/html emails, and automatically converts image references to inline image attachments.</dd>
</dl>
</li>
<li>
<dl>
<dt><a href="http://drupal.org/project/pathologic">Pathologic</a></dt>
<dd>Converts urls from relative to absolute, so clickable links in your email messages work as intended.</dd>
</dl>
</li>
<li>
<dl>
<dt><a href="http://drupal.org/project/filter_transliteration">Transliteration</a></dt>
<dd>
<p>Converts non-ASCII characters to their US-ASCII equivalents, such as from Microsoft "smart-quotes" to regular quotes.</p>
</dd>
<dd>
<p><em>Also available as a <a href="http://drupal.org/node/1095278#comment-4219530">patch</a>.</em></p>
</dd>
</dl>
</li>
</ul>
<h3><a href="http://drupal.org/node/250790">Updating from previous versions</a></h3>
<p>The <a href="http://drupal.org/node/1106064">7.x-2.x</a> branch shares 94% of its code with the <a href="http://drupal.org/node/1119548">6.x-2.x</a> branch, but only 15% of its code with the <a href="http://drupal.org/node/355250">7.x-1.x</a> branch, and a tiny 8% of its code with the <a href="http://drupal.org/node/329828">6.x-1.x</a> branch.</p>
<p>Let your compatibility expectations be adjusted accordingly.</p>
<ul>
<li>
<p>Check the module dependencies, as they have changed. The latest version of <a href="http://drupal.org/project/htmlmail">HTML Mail</a> depends on the <a href="http://drupal.org/project/mailsystem">Mail System</a> module (7.x-2.2 or later) and will not work without it.</p>
</li>
<li>
<p>Run <code>update.php</code> <em>immediately</em> after uploading new code.</p>
</li>
<li>
<p>The user-interface for adding email header and footer text has been removed. Headers and footers may be added by template files and/or by enabling the <a href="http://drupal.org/project/echo">Echo</a> module.</p>
</li>
<li>
<p>Any customized filters should be carefully tested, as some of the template variables have changed. Full documentation is provided both on the module configuration page (Click on the <u>Instructions</u> link) and as comments within the <code>htmlmail.tpl.php</code> file itself.</p>
</li>
<li>
<p>The following options have been removed from the module settings page. In their place, any combination of <a href="http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1">over 200 filter modules</a> may be used to create an email-specific <a href="http://drupal.org/node/778976">text format</a> for post-template filtering.</p>
<ul>
<li><a href="http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_autop/7">Line break converter</a></li>
<li><a href="http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_url/7">URL Filter</a></li>
<li><a href="http://drupal.org/project/rel_to_abs">Relative Path to Absolute URLs</a></li>
<li><a href="http://www.pelagodesign.com/sidecar/emogrifier/">Emogrifier</a></li>
<li><a href="http://drupal.org/project/token">Token support</a></li>
</ul>
</li>
<li>
<p>Full MIME handling, including automatic generation of a plaintext alternative part and conversion of image references to inline image attachments, is available simply by enabling the <a href="http://drupal.org/project/mailmime">Mail MIME</a> module.</p>
</li>
</ul>
<h3><a href="http://drupal.org/files/images/htmlmail_settings_2.thumbnail.png">Configuration</a></h3>
<p>Visit the <a href="http://drupal.org/project/mailsystem">Mail System</a> settings page at <u>admin/config/system/mailsystem</u> to select which parts of Drupal will use <a href="http://drupal.org/project/htmlmail">HTML Mail</a> instead of the <a href="http://api.drupal.org/api/drupal/modules--system--system.mail.inc/class/DefaultMailSystem/7">default</a> <a href="http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7">mail system</a>.</p>
<p>Visit the <a href="http://drupal.org/project/htmlmail">HTML Mail</a> settings page at <u>admin/config/system/htmlmail</u> to select a theme and post-filter for your messages.</p>
<h3><a href="http://drupal.org/documentation/theme">Theming</a></h3>
<p>The email message text goes through three transformations before sending:</p>
<ol style="list-style-type: decimal;">
<li>
<h3>Template File</h3>
<p>A template file is applied to your message header, subject, and body text. The default template is the included <code>htmlmail.tpl.php</code> file. You may copy this file to your <cite>email theme</cite> directory (selected below), and use it to customize the contents and formatting of your messages. The comments within that file contain complete documentation on its usage.</p>
</li>
<li>
<h3>Theming</h3>
<p>You may choose a theme that will hold your templates from Step 1 above. If the <a href="http://drupal.org/project/echo">Echo</a> module is installed, this theme will also be used to wrap your templated text in a webpage. You use any one of <a href="http://drupal.org/project/themes">over 800</a> themes to style your messages, or <a href="http://drupal.org/documentation/theme">create your own</a> for even more power and flexibility.</p>
</li>
<li>
<h3>Post-filtering</h3>
<p>You may choose a <a href="http://drupal.org/node/778976">text format</a> to be used for filtering email messages <em>after</em> theming. This allows you to use any combination of <a href="http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1">over 200 filter modules</a> to make final changes to your message before sending.</p>
<p>Here is a recommended configuration:</p>
<ul>
<li>
<p><a href="http://drupal.org/project/emogrifier">Emogrifier</a> Converts stylesheets to inline style rules for consistent display on mobile devices and webmail.</p>
</li>
<li>
<p><a href="http://drupal.org/project/filter_transliteration">Transliteration</a> Converts non-ASCII text to US-ASCII equivalents. This helps prevent Microsoft "smart-quotes" from appearing as question-marks in Mozilla Thunderbird.</p>
</li>
<li>
<p><a href="http://drupal.org/project/pathologic">Pathologic</a> Converts relative URLS to absolute URLS so that clickable links in your message will work as intended.</p>
</li>
</ul>
</li>
</ol>
<h3>Troubleshooting</h3>
<ul>
<li>
<p>Double-check the <a href="http://drupal.org/project/mailsystem">Mail System</a> module settings and and make sure you selected <u><code>HTMLMailSystem</code></u> for your <u>Site-wide default mail system</u>.</p>
</li>
<li>
<p>Try selecting the <u><code>[ ]</code> <em>(Optional)</em> Debug</u> checkbox at the <a href="http://drupal.org/project/htmlmail">HTML Mail</a> module settings page and re-sending your message.</p>
</li>
<li>
<p>Clear your cache after changing any <u><code>.tpl.php</code></u> files.</p>
</li>
<li>
<p>If you use a post-filter, make sure your filter settings page looks like <a href="http://drupal.org/node/1130960">this</a>.</p>
</li>
<li>
<p>Visit the <a href="http://drupal.org/project/issues/htmlmail">issue queue</a> for support and feature requests.</p>
</li>
</ul>
<h3>Related Modules</h3>
<dl>
<dt><strong>Echo</strong></dt>
<dd>
<p>http://drupal.org/project/echo</p>
</dd>
<dt><strong>Emogrifier</strong></dt>
<dd>
<p>http://drupal.org/project/emogrifier</p>
</dd>
<dt><strong>HTML Purifier</strong></dt>
<dd>
<p>http://drupal.org/project/htmlpurifier</p>
</dd>
<dt><strong>htmLawed</strong></dt>
<dd>
<p>http://drupal.org/project/htmlawed</p>
</dd>
<dt><strong>Mail MIME</strong></dt>
<dd>
<p>http://drupal.org/project/mailmime</p>
</dd>
<dt><strong>Mail System</strong></dt>
<dd>
<p>http://drupal.org/project/mailsystem</p>
</dd>
<dt><strong>Pathologic</strong></dt>
<dd>
<p>http://drupal.org/project/pathologic</p>
</dd>
<dt><strong>Transliteration</strong></dt>
<dd>
<p>http://drupal.org/project/transliteration</p>
</dd>
</dl>
<h3><a href="http://drupal.org/project/documentation">Documentation</a></h3>
<dl>
<dt><strong><a href="http://api.drupal.org/api/drupal/modules--filter--filter.module/6">filter.module</a></strong></dt>
<dd><a href="http://api.drupal.org/api/drupal/modules--filter--filter.module/7">api.drupal.org/api/drupal/modules--filter--filter.module</a></dd>
<dd>
<p><a href="http://api.drupal.org/api/drupal/modules--filter--filter.module/group/standard_filters/7">api.drupal.org/api/drupal/modules--filter--filter.module/group/standard_filters/7</a></p>
</dd>
<dt><strong><a href="http://drupal.org/documentation/install/modules-themes/modules-7">Installing contributed modules</a></strong></dt>
<dd>
<p><a href="http://drupal.org/documentation/install/modules-themes/modules-7">drupal.org/documentation/install/modules-themes/modules-7</a></p>
</dd>
<dt><strong><a href="http://drupal.org/documentation/theme">Theming guide</a></strong></dt>
<dd>
<p><a href="http://drupal.org/documentation/theme">drupal.org/documentation/theme</a></p>
</dd>
</dl>
<h3>Original Author</h3>
<ul>
<li><a href="http://drupal.org/user/1171">Chris Herberte</a></li>
</ul>
<h3>Current Maintainer</h3>
<ul>
<li><a href="http://drupal.org/user/36148">Bob Vincent</a></li>
</ul>

View File

@@ -0,0 +1,216 @@
## [HTML Mail](http://drupal.org/project/htmlmail)
Lets you theme your messages the same way you theme the rest of your website.
### [Requirement](http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query=requirement)
* [Mail System 7.x-2.x](http://drupal.org/project/mailsystem)
### [Installation](http://drupal.org/documentation/install/modules-themes/modules-7)
The following additional modules, while not required, are highly recommended:
* [Echo](http://drupal.org/project/echo)
: Wraps your messages in a drupal theme. Now you can "brand" your
messages with the same logo, header, fonts, and styles as your website.
* [Emogrifier](http://drupal.org/project/emogrifier)
: Converts stylesheets to inline style rules, for consistent display on
mobile devices and webmail.
* [Mail MIME](http://drupal.org/project/mailmime)
: Provides a text/plain alternative to text/html emails, and automatically
converts image references to inline image attachments.
* [Pathologic](http://drupal.org/project/pathologic)
: Converts urls from relative to absolute, so clickable links in your
email messages work as intended.
* [Transliteration](http://drupal.org/project/filter_transliteration)
: Converts non-ASCII characters to their US-ASCII equivalents, such
as from Microsoft "smart-quotes" to regular quotes.
: *Also available as a [patch](http://drupal.org/node/1095278#comment-4219530).*
### [Updating from previous versions](http://drupal.org/node/250790)
The [7.x-2.x](http://drupal.org/node/1106064) branch shares 94% of its code
with the [6.x-2.x](http://drupal.org/node/1119548) branch, but only 15% of
its code with the [7.x-1.x](http://drupal.org/node/355250) branch, and a tiny
8% of its code with the [6.x-1.x](http://drupal.org/node/329828) branch.
Let your compatibility expectations be adjusted accordingly.
* Check the module dependencies, as they have changed. The latest version of
[HTML Mail](http://drupal.org/project/htmlmail) depends on the
[Mail System](http://drupal.org/project/mailsystem) module (7.x-2.2 or later)
and will not work without it.
* Run `update.php` *immediately* after uploading new code.
* The user-interface for adding email header and footer text has been removed.
Headers and footers may be added by template files and/or by enabling the
[Echo](http://drupal.org/project/echo) module.
* Any customized filters should be carefully tested, as some of the template
variables have changed. Full documentation is provided both on the module
configuration page (Click on the <u>Instructions</u> link) and as comments
within the `htmlmail.tpl.php` file itself.
* The following options have been removed from the module settings page. In
their place, any combination of
[over 200 filter modules](http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1)
may be used to create an email-specific
[text format](http://drupal.org/node/778976)
for post-template filtering.
* [Line break converter](http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_autop/7)
* [URL Filter](http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_url/7)
* [Relative Path to Absolute URLs](http://drupal.org/project/rel_to_abs)
* [Emogrifier](http://www.pelagodesign.com/sidecar/emogrifier/)
* [Token support](http://drupal.org/project/token)
* Full MIME handling, including automatic generation of a plaintext
alternative part and conversion of image references to inline image
attachments, is available simply by enabling the
[Mail MIME](http://drupal.org/project/mailmime) module.
### [Configuration](http://drupal.org/files/images/htmlmail_settings_2.thumbnail.png)
Visit the [Mail System](http://drupal.org/project/mailsystem) settings page at
<u>admin/config/system/mailsystem</u>
to select which parts of Drupal will use
[HTML Mail](http://drupal.org/project/htmlmail)
instead of the
[default](http://api.drupal.org/api/drupal/modules--system--system.mail.inc/class/DefaultMailSystem/7)
[mail system](http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7).
Visit the [HTML Mail](http://drupal.org/project/htmlmail) settings page at
<u>admin/config/system/htmlmail</u>
to select a theme and post-filter for your messages.
### [Theming](http://drupal.org/documentation/theme)
The email message text goes through three transformations before sending:
1. <h3>Template File</h3>
A template file is applied to your message header, subject, and body text.
The default template is the included `htmlmail.tpl.php` file. You may copy
this file to your <cite>email theme</cite> directory (selected below), and
use it to customize the contents and formatting of your messages. The
comments within that file contain complete documentation on its usage.
2. <h3>Theming</h3>
You may choose a theme that will hold your templates from Step 1 above. If
the [Echo](http://drupal.org/project/echo) module is installed, this theme
will also be used to wrap your templated text in a webpage. You use any one
of [over 800](http://drupal.org/project/themes) themes to style your
messages, or [create your own](http://drupal.org/documentation/theme) for
even more power and flexibility.
3. <h3>Post-filtering</h3>
You may choose a
[text format](http://drupal.org/node/778976)
to be used for filtering email messages *after* theming.
This allows you to use any combination of
[over 200 filter modules](http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1)
to make final changes to your message before sending.
Here is a recommended configuration:
* [Emogrifier](http://drupal.org/project/emogrifier)
Converts stylesheets to inline style rules for consistent display on
mobile devices and webmail.
* [Transliteration](http://drupal.org/project/filter_transliteration)
Converts non-ASCII text to US-ASCII equivalents. This helps prevent
Microsoft "smart-quotes" from appearing as question-marks in
Mozilla Thunderbird.
* [Pathologic](http://drupal.org/project/pathologic)
Converts relative URLS to absolute URLS so that clickable links in
your message will work as intended.
### Troubleshooting
* Check the [online documentation](http://drupal.org/node/1124376),
especially the [screenshots](http://drupal.org/node/1124934).
* There is a special documentation page for
[Using HTML Mail together with SMTP Authentication Support](http://drupal.org/node/1200142).
* [Simplenews](http://drupal.org/project/simplenews) users attempting advanced
theming should read [this page](http://drupal.org/node/1260178).
* Double-check the [Mail System](http://drupal.org/project/mailsystem)
module settings and and make sure you selected
<u><code>HTMLMailSystem</code></u> for your
<u>Site-wide default mail system</u>.
* Try selecting the <u><code>[ ]</code> *(Optional)* Debug</u> checkbox
at the [HTML Mail](http://drupal.org/project/htmlmail) module
settings page and re-sending your message.
* Clear your cache after changing any <u><code>.tpl.php</code></u>
files.
* If you use a post-filter, make sure your filter settings page looks like
[this](http://drupal.org/node/1130960).
* Visit the [issue queue](http://drupal.org/project/issues/htmlmail)
for support and feature requests.
### Related Modules
**Echo**
: http://drupal.org/project/echo
**Emogrifier**
: http://drupal.org/project/emogrifier
**HTML Purifier**
: http://drupal.org/project/htmlpurifier
**htmLawed**
: http://drupal.org/project/htmlawed
**Mail MIME**
: http://drupal.org/project/mailmime
**Mail System**
: http://drupal.org/project/mailsystem
**Pathologic**
: http://drupal.org/project/pathologic
**Transliteration**
: http://drupal.org/project/transliteration
### [Documentation](http://drupal.org/project/documentation)
**[HTML Mail](http://drupal.org/node/1124376)
**[filter.module](http://api.drupal.org/api/drupal/modules--filter--filter.module/6)**
: [api.drupal.org/api/drupal/modules--filter--filter.module](http://api.drupal.org/api/drupal/modules--filter--filter.module/7)
: [api.drupal.org/api/drupal/modules--filter--filter.module/group/standard_filters/7](http://api.drupal.org/api/drupal/modules--filter--filter.module/group/standard_filters/7)
**[Installing contributed modules](http://drupal.org/documentation/install/modules-themes/modules-7)**
: [drupal.org/documentation/install/modules-themes/modules-7](http://drupal.org/documentation/install/modules-themes/modules-7)
**[Theming guide](http://drupal.org/documentation/theme)**
: [drupal.org/documentation/theme](http://drupal.org/documentation/theme)
### Original Author
* [Chris Herberte](http://drupal.org/user/1171)
### Current Maintainer
* [Bob Vincent](http://drupal.org/user/36148)

View File

@@ -0,0 +1,235 @@
[1]HTML Mail
Lets you theme your messages the same way you theme the rest of your
website.
[2]Requirement
* [3]Mail System 7.x-2.x
[4]Installation
The following additional modules, while not required, are highly
recommended:
*
[5]Echo
Wraps your messages in a drupal theme. Now you can "brand"
your messages with the same logo, header, fonts, and
styles as your website.
*
[6]Emogrifier
Converts stylesheets to inline style rules, for consistent
display on mobile devices and webmail.
*
[7]Mail MIME
Provides a text/plain alternative to text/html emails, and
automatically converts image references to inline image
attachments.
*
[8]Pathologic
Converts urls from relative to absolute, so clickable
links in your email messages work as intended.
*
[9]Transliteration
Converts non-ASCII characters to their US-ASCII
equivalents, such as from Microsoft "smart-quotes" to
regular quotes.
Also available as a [10]patch.
[11]Updating from previous versions
The [12]7.x-2.x branch shares 94% of its code with the [13]6.x-2.x
branch, but only 15% of its code with the [14]7.x-1.x branch, and a
tiny 8% of its code with the [15]6.x-1.x branch.
Let your compatibility expectations be adjusted accordingly.
* Check the module dependencies, as they have changed. The latest
version of [16]HTML Mail depends on the [17]Mail System module
(7.x-2.2 or later) and will not work without it.
* Run update.php immediately after uploading new code.
* The user-interface for adding email header and footer text has been
removed. Headers and footers may be added by template files and/or
by enabling the [18]Echo module.
* Any customized filters should be carefully tested, as some of the
template variables have changed. Full documentation is provided
both on the module configuration page (Click on the Instructions
link) and as comments within the htmlmail.tpl.php file itself.
* The following options have been removed from the module settings
page. In their place, any combination of [19]over 200 filter
modules may be used to create an email-specific [20]text format for
post-template filtering.
+ [21]Line break converter
+ [22]URL Filter
+ [23]Relative Path to Absolute URLs
+ [24]Emogrifier
+ [25]Token support
* Full MIME handling, including automatic generation of a plaintext
alternative part and conversion of image references to inline image
attachments, is available simply by enabling the [26]Mail MIME
module.
[27]Configuration
Visit the [28]Mail System settings page at
admin/config/system/mailsystem to select which parts of Drupal will use
[29]HTML Mail instead of the [30]default [31]mail system.
Visit the [32]HTML Mail settings page at admin/config/system/htmlmail
to select a theme and post-filter for your messages.
[33]Theming
The email message text goes through three transformations before
sending:
1. Template File
A template file is applied to your message header, subject, and
body text. The default template is the included htmlmail.tpl.php
file. You may copy this file to your email theme directory
(selected below), and use it to customize the contents and
formatting of your messages. The comments within that file contain
complete documentation on its usage.
2. Theming
You may choose a theme that will hold your templates from Step 1
above. If the [34]Echo module is installed, this theme will also be
used to wrap your templated text in a webpage. You use any one of
[35]over 800 themes to style your messages, or [36]create your own
for even more power and flexibility.
3. Post-filtering
You may choose a [37]text format to be used for filtering email
messages after theming. This allows you to use any combination of
[38]over 200 filter modules to make final changes to your message
before sending.
Here is a recommended configuration:
+ [39]Emogrifier Converts stylesheets to inline style rules for
consistent display on mobile devices and webmail.
+ [40]Transliteration Converts non-ASCII text to US-ASCII
equivalents. This helps prevent Microsoft "smart-quotes" from
appearing as question-marks in Mozilla Thunderbird.
+ [41]Pathologic Converts relative URLS to absolute URLS so that
clickable links in your message will work as intended.
Troubleshooting
* Double-check the [42]Mail System module settings and and make sure
you selected HTMLMailSystem for your Site-wide default mail system.
* Try selecting the [ ] (Optional) Debug checkbox at the [43]HTML
Mail module settings page and re-sending your message.
* Clear your cache after changing any .tpl.php files.
* If you use a post-filter, make sure your filter settings page looks
like [44]this.
* Visit the [45]issue queue for support and feature requests.
Related Modules
Echo
http://drupal.org/project/echo
Emogrifier
http://drupal.org/project/emogrifier
HTML Purifier
http://drupal.org/project/htmlpurifier
htmLawed
http://drupal.org/project/htmlawed
Mail MIME
http://drupal.org/project/mailmime
Mail System
http://drupal.org/project/mailsystem
Pathologic
http://drupal.org/project/pathologic
Transliteration
http://drupal.org/project/transliteration
[46]Documentation
[47]filter.module
[48]api.drupal.org/api/drupal/modules--filter--filter.module
[49]api.drupal.org/api/drupal/modules--filter--filter.module/gro
up/standard_filters/7
[50]Installing contributed modules
[51]drupal.org/documentation/install/modules-themes/modules-7
[52]Theming guide
[53]drupal.org/documentation/theme
Original Author
* [54]Chris Herberte
Current Maintainer
* [55]Bob Vincent
References
1. http://drupal.org/project/htmlmail
2. http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query=requirement
3. http://drupal.org/project/mailsystem
4. http://drupal.org/documentation/install/modules-themes/modules-7
5. http://drupal.org/project/echo
6. http://drupal.org/project/emogrifier
7. http://drupal.org/project/mailmime
8. http://drupal.org/project/pathologic
9. http://drupal.org/project/filter_transliteration
10. http://drupal.org/node/1095278#comment-4219530
11. http://drupal.org/node/250790
12. http://drupal.org/node/1106064
13. http://drupal.org/node/1119548
14. http://drupal.org/node/355250
15. http://drupal.org/node/329828
16. http://drupal.org/project/htmlmail
17. http://drupal.org/project/mailsystem
18. http://drupal.org/project/echo
19. http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1
20. http://drupal.org/node/778976
21. http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_autop/7
22. http://api.drupal.org/api/drupal/modules--filter--filter.module/function/_filter_url/7
23. http://drupal.org/project/rel_to_abs
24. http://www.pelagodesign.com/sidecar/emogrifier/
25. http://drupal.org/project/token
26. http://drupal.org/project/mailmime
27. http://drupal.org/files/images/htmlmail_settings_2.thumbnail.png
28. http://drupal.org/project/mailsystem
29. http://drupal.org/project/htmlmail
30. http://api.drupal.org/api/drupal/modules--system--system.mail.inc/class/DefaultMailSystem/7
31. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
32. http://drupal.org/project/htmlmail
33. http://drupal.org/documentation/theme
34. http://drupal.org/project/echo
35. http://drupal.org/project/themes
36. http://drupal.org/documentation/theme
37. http://drupal.org/node/778976
38. http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1
39. http://drupal.org/project/emogrifier
40. http://drupal.org/project/filter_transliteration
41. http://drupal.org/project/pathologic
42. http://drupal.org/project/mailsystem
43. http://drupal.org/project/htmlmail
44. http://drupal.org/node/1130960
45. http://drupal.org/project/issues/htmlmail
46. http://drupal.org/project/documentation
47. http://api.drupal.org/api/drupal/modules--filter--filter.module/6
48. http://api.drupal.org/api/drupal/modules--filter--filter.module/7
49. http://api.drupal.org/api/drupal/modules--filter--filter.module/group/standard_filters/7
50. http://drupal.org/documentation/install/modules-themes/modules-7
51. http://drupal.org/documentation/install/modules-themes/modules-7
52. http://drupal.org/documentation/theme
53. http://drupal.org/documentation/theme
54. http://drupal.org/user/1171
55. http://drupal.org/user/36148

View File

@@ -0,0 +1,32 @@
<?php
/**
* @file
* Sample template for HTML Mail test messages.
*/
?>
<h1><a href="http://drupal.org/project/htmlmail">HTML Mail</a> test message</h1>
<div class="htmlmail-body">
<?php echo $body; ?>
</div>
<?php if ($debug): ?>
<hr />
<div class="htmlmail-debug">
<dl><dt><p>
To customize this test message:
</p></dt><dd><ol><li><p><?php if (empty($theme)): ?>
Visit <u>admin/config/system/htmlmail</u>
and select a theme to hold your custom email template files.
</p></dt><dd><ol><li><p><?php elseif (empty($theme_path)): ?>
Visit <u>admin/appearance</u>
to enable your selected <u><?php echo ucfirst($theme); ?></u> theme.
</p></dt><dd><ol><li><p><?php endif; ?>
Copy the
<a href="http://drupalcode.org/project/htmlmail.git/blob_plain/refs/heads/7.x-2.x:/htmlmail--htmlmail.tpl.php"><code>htmlmail--htmlmail.tpl.php</code></a>
file to your <u><?php echo ucfirst($theme); ?></u> theme directory
<u><code><?php echo $theme_path; ?></code></u>.
</p></li><li><p>
Edit the copied file.
</p></li></ol></dd></dl>
</div>
<?php endif;

View File

@@ -0,0 +1,144 @@
<?php
/**
* @file
* Sample template for sending Simplenews messages with HTML Mail.
*
* The following variables are available in this template:
*
* - $message_id: The email message id, or "simplenews_$key"
* - $module: The sending module, which is 'simplenews'.
* - $key: The simplenews action, which may be any of the following:
* - node: Send a newsletter to its subscribers.
* - subscribe: New subscriber confirmation message.
* - test: Send a test newsletter to the test address.
* - unsubscribe: Unsubscribe confirmation message.
* - $headers: An array of email (name => value) pairs.
* - $from: The configured sender address.
* - $to: The recipient subscriber email address.
* - $subject: The message subject line.
* - $body: The formatted message body.
* - $language: The language object for this message.
* - $params: An array containing the following keys:
* - context: An array containing the following keys:
* - account: The recipient subscriber account object, which contains
* the following useful properties:
* - snid: The simplenews subscriber id, or NULL for test messages.
* - name: The subscriber username, or NULL.
* - activated: The date this subscription became active, or NULL.
* - uid: The subscriber user id, or NULL.
* - mail: The subscriber email address; same as $message['to'].
* - language: The subscriber language code.
* - tids: An array of taxonomy term ids.
* - newsletter_subscription: An array of subscription ids.
* - node: The simplenews newsletter node object, which contains the
* following useful properties:
* - changed: The node last-modified date, as a unix timestamp.
* - created: The node creation date, as a unix timestamp.
* - name: The username of the node publisher.
* - nid: The node id.
* - title: The node title.
* - uid: The user ID of the node publisher.
* - newsletter: The simplenews newsletter object, which contains the
* following useful properties:
* - nid: The node ID of the newsletter node.
* - name: The short name of the newsletter.
* - description: The long name or description of the newsletter.
* - $template_path: The relative path to the template directory.
* - $template_url: The absolute url to the template directory.
* - $theme: The name of the selected Email theme.
* - $theme_path: The relative path to the Email theme directory.
* - $theme_url: The absolute url to the Email theme directory.
*/
$template_name = basename(__FILE__);
$current_path = realpath(NULL);
$current_len = strlen($current_path);
$template_path = realpath(dirname(__FILE__));
if (!strncmp($template_path, $current_path, $current_len)) {
$template_path = substr($template_path, $current_len + 1);
}
$template_url = url($template_path, array('absolute' => TRUE));
?>
<?php if ($key == 'node' || $key == 'test'): ?>
<div class="htmlmail-simplenews-link">
<a href="<?php echo url('node/' . $params['simplenews_source']->getNode()->nid, array('absolute' => TRUE)); ?>">
Click here to view this message on the web.
</a>
</div>
<?php endif; ?>
<div class="htmlmail-simplenews-body htmlmail-body">
<?php echo $body; ?>
</div>
<?php if ($debug):
$module_template = 'htmlmail--simplenews.tpl.php';
$message_template = "htmlmail--simplenews--$key.tpl.php";
?>
<hr />
<div class="htmlmail-simplenews-debug htmlmail-debug">
<dl><dt><p>
To customize your simplenews messages:
</p></dt><dd><ol><li><p><?php if (empty($theme)): ?>
Visit <u>admin/config/system/htmlmail</u>
and select a theme to hold your custom email template files.
</p></li><li><p><?php elseif (empty($theme_path)): ?>
Visit <u>admin/appearance</u>
to enable your selected <u><?php echo drupal_ucfirst($theme); ?></u> theme.
</p></li><li><?php endif;
if ("$template_path/$template_name" == "$theme_path/$message_template"): ?><p>
Edit your<br />
<u><code><?php echo "$template_path/$template_name"; ?></code></u>
<br />file.
</p></li><li><?php
else:
if (!file_exists("$theme_path/htmlmail.tpl.php")): ?><p>
Copy<br />
<u><code><?php echo "$module_path/htmlmail.tpl.php"; ?></code></u>
<br />to<br />
<u><code><?php echo "$theme_path/htmlmail.tpl.php"; ?></code></u>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$module_template")): ?><p>
For general Simplenews message customization, copy<br />
<u><code><?php echo "$module_path/htmlmail.tpl.php"; ?></code></u>
<br />to<br />
<code><?php echo "$theme_path/$module_template"; ?></code>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$message_template")): ?><p>
For message-specific customization, copy<br />
<u><code><?php echo "$module_path/htmlmail.tpl.php"; ?></code></u>
<br />to one of the following:
</p><ul><li><dl><dt><p>
<u><code>htmlmail--simplenews--node.tpl.php</code></u>
</p></dt><dd><p>
Regular newsletter template.
</p></dd></dl></li><li><dl><dt><p>
<u><code>htmlmail--simplenews--subscribe.tpl.php</code></u>
</p></dt><dd><p>
New subscriber confirmation message.
</p></dd></dl></li><li><dl><dt><p>
<u><code>htmlmail--simplenews--test.tpl.php</code></u>
</p></dt><dd><p>
Test newsletter.
</p></dd></dl></li><li><dl><dt><p>
<u><code>htmlmail--simplenews--unsubscribe.tpl.php</code></u>
</p></dt><dd><p>
Unsubscribe confirmation message.
</p></dd></dl></li></ul></li><li><?php
endif; ?><p>
Edit the copied file.
</p></li><li><?php
endif; ?><p>
Send a test message to make sure your customizations worked.
</p></li><li><p>
If you think your customizations would be of use to others,
please contribute your file as a feature request in the
<a href="http://drupal.org/node/add/project-issue/htmlmail">issue queue</a>.
</p></li></ol></dd><dt><p>
The simplenews module sets the <u><code>$params</code></u> variable.
For this message,
</p></dt><dd><p><code><pre>
$params = <?php echo check_plain(print_r($params, 1)); ?>
</pre></code></p></dd></dl>
</div>
<?php endif;

View File

@@ -0,0 +1,112 @@
<?php
/**
* @file
* Sample template for sending user password reset messages with HTML Mail
*
* The following variables are available in this template:
*
* - $message_id: The email message id, which is 'user_password_reset'
* - $module: The sending module, which is 'user'.
* - $key: The user email action, which is 'password_reset'.
* - $headers: An array of email (name => value) pairs.
* - $from: The configured sender address.
* - $to: The recipient email address.
* - $subject: The message subject line.
* - $body: The formatted message body.
* - $language: The language object for this message.
* - $params: An array containing the following keys:
* - account: The user object whose password is being requested, which
* contains the following useful properties:
* - uid: The user-id number.
* - name: The user login name.
* - mail: The user email address. Should be the same as $to.
* - theme: The user-chosen theme, or a blank string if unset.
* - signature: The user signature block.
* - signature_format: The text input filter used to format the signature.
* - created: Account creation date, as a unix timestamp.
* - access: Account access date, as a unix timestamp.
* - login: Account login date, as a unix timestamp.
* - status: Integer 0 = disabled; 1 = enabled.
* - timezone: User timezone, or NULL if unset.
* - language: User language, or blank string if unset.
* - picture: Path to user picture, or blank string if unset.
* - init: The email address used to initially register this account.
* - data: User profile data, as a serialized string.
* - roles: Array of roles assigned to this user, as (rid => role_name)
* pairs.
* - $template_path: The relative path to the template directory.
* - $template_url: The absolute url to the template directory.
* - $theme: The name of the selected Email theme.
* - $theme_path: The relative path to the Email theme directory.
* - $theme_url: The absolute url to the Email theme directory.
*/
$template_name = basename(__FILE__);
$current_path = realpath(NULL);
$current_len = strlen($current_path);
$template_path = realpath(dirname(__FILE__));
if (!strncmp($template_path, $current_path, $current_len)) {
$template_path = substr($template_path, $current_len + 1);
}
$template_url = url($template_path, array('absolute' => TRUE));
?>
<div class="htmlmail-user-password-reset-body htmlmail-user-body htmlmail-body">
<?php echo $body; ?>
</div>
<?php if ($debug):
$module_template = "htmlmail--user.tpl.php";
$message_template = 'htmlmail--user--password_reset.tpl.php';
?>
<hr />
<div class="htmlmail-user-password-reset-debug htmlmail-user-debug htmlmail-debug">
<dl><dt><p>
To customize your user password reset messages:
</p></dt><dd><ol><li><p><?php if (empty($theme)): ?>
Visit <u>admin/config/system/htmlmail</u>
and select a theme to hold your custom email template files.
</p></li><li><p><?php elseif (empty($theme_path)): ?>
Visit <u>admin/build/themes</u>
to enable your selected <u><?php echo drupal_ucfirst($theme); ?></u> theme.
</p></li><li><?php endif;
if ("$template_path/$template_name" == "$theme_path/$message_template"): ?><p>
Edit your<br />
<u><code><?php echo "$template_path/$template_name"; ?></code></u>
<br />file.
</p></li><li><?php
else:
if (!file_exists("$theme_path/htmlmail.tpl.php")): ?><p>
Copy<br />
<u><code><?php echo "$module_path/htmlmail.tpl.php"; ?></code></u>
<br />to<br />
<u><code><?php echo "$theme_path/htmlmail.tpl.php"; ?></code></u>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$module_template")): ?><p>
For general user-module message customization, copy<br />
<u><code><?php echo "$module_path/htmlmail.tpl.php"; ?></code></u>
<br />to<br />
<code><?php echo "$theme_path/$module_template"; ?></code>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$message_template")): ?><p>
Copy<br />
<u><code><?php echo "$template_path/$template_name"; ?></code></u>
<br />to<br />
<u><code><?php echo "$theme_path/$message_template"; ?></code></u>.
</p></li><li><?php endif; ?><p>
Edit the copied file.
</p></li><li><?php
endif; ?><p>
Send a test message to make sure your customizations worked.
</p></li><li><p>
If you think your customizations would be of use to others,
please contribute your file as a feature request in the
<a href="http://drupal.org/node/add/project-issue/htmlmail">issue queue</a>.
</p></li></ol></dd><dt><p>
The user module sets the <u><code>$params</code></u> variable.
For this message,
</p></dt><dd><p><code><pre>
$params = <?php echo check_plain(print_r($params, 1)); ?>
</pre></code></p></dd></dl>
</div>
<?php endif;

View File

@@ -0,0 +1,314 @@
<?php
/**
* @file
* Admin forms for HTML Mail
*/
/**
* Implements hook_admin_settings().
*/
function htmlmail_admin_settings() {
$formats = array('0' => t('Unfiltered'));
foreach (filter_formats() as $id => $filter) {
$formats[$id] = $filter->name;
}
$form['template'] = array(
'#type' => 'fieldset',
'#title' => t('Step 1'),
'#collapsible' => FALSE,
);
$form['template']['htmlmail_template'] = array(
'#type' => 'fieldset',
'#prefix' => '<strong>' . t('Template file') . ':</strong><br />'
. t('A template file is applied to your message header, subject, and body text. You may copy the <a href="!uri">!template</a> file to your default theme directory and use it to customize your messages.',
array(
'!uri' => url('http://drupalcode.org/project/htmlmail.git/blob_plain/refs/heads/7.x-2.x:/htmlmail.tpl.php'),
'!template' => '<code>htmlmail.tpl.php</code>'
)
),
'#title' => t('Instructions'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['template']['htmlmail_template']['instructions'] = array(
'#type' => 'item',
'#suffix' => t('!Instructions
<p>When formatting an email message with a given <code>$module</code> and <code>$key</code>, <a href="http://drupal.org/project/htmlmail">HTML Mail</a> will use the first template file it finds from the following list:</p>
<ol style="list-style-type: decimal;">
<li><code>htmlmail--$module--$key.tpl.php</code></li>
<li><code>htmlmail--$module.tpl.php</code></li>
<li><code>htmlmail.tpl.php</code></li>
</ol>
<p>For each filename, <a href="http://drupal.org/project/htmlmail">HTML Mail</a> looks first in the chosen <em>Email theme</em> directory, then in its own module directory, before proceeding to the next filename.</p>
<p>For example, if <code>example_module</code> sends mail with:</p>
<pre>
<code>drupal_mail("example_module", "outgoing_message" ...)
</code>
</pre>
<p>the possible template file names would be:</p>
<ol style="list-style-type: decimal;">
<li><code>htmlmail--example_module--outgoing_message.tpl.php</code></li>
<li><code>htmlmail--example_module.tpl.php</code></li>
<li><code>htmlmail.tpl.php</code></li>
</ol>
<p>Template files are cached, so remember to clear the cache by visiting <u>admin/config/development/performance</u> after changing any <code>.tpl.php</code> files.</p>
<p>The following variables available in this template:</p>
<dl>
<dt><strong><code>$body</code></strong></dt>
<dd>
<p>The message body text.</p>
</dd>
<dt><strong><code>$module</code></strong></dt>
<dd>
<p>The first argument to <a href="http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7"><code>drupal_mail()</code></a>, which is, by convention, the machine-readable name of the sending module.</p>
</dd>
<dt><strong><code>$key</code></strong></dt>
<dd>
<p>The second argument to <a href="http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7"><code>drupal_mail()</code></a>, which should give some indication of why this email is being sent.</p>
</dd>
<dt><strong><code>$message_id</code></strong></dt>
<dd>
<p>The email message id, which should be equal to <code>"{$module}_{$key}"</code>.</p>
</dd>
<dt><strong><code>$headers</code></strong></dt>
<dd>
<p>An array of email <code>(name =&gt; value)</code> pairs.</p>
</dd>
<dt><strong><code>$from</code></strong></dt>
<dd>
<p>The configured sender address.</p>
</dd>
<dt><strong><code>$to</code></strong></dt>
<dd>
<p>The recipient email address.</p>
</dd>
<dt><strong><code>$subject</code></strong></dt>
<dd>
<p>The message subject line.</p>
</dd>
<dt><strong><code>$body</code></strong></dt>
<dd>
<p>The formatted message body.</p>
</dd>
<dt><strong><code>$language</code></strong></dt>
<dd>
<p>The language object for this message.</p>
</dd>
<dt><strong><code>$params</code></strong></dt>
<dd>
<p>Any module-specific parameters.</p>
</dd>
<dt><strong><code>$template_name</code></strong></dt>
<dd>
<p>The basename of the active template.</p>
</dd>
<dt><strong><code>$template_path</code></strong></dt>
<dd>
<p>The relative path to the template directory.</p>
</dd>
<dt><strong><code>$template_url</code></strong></dt>
<dd>
<p>The absolute URL to the template directory.</p>
</dd>
<dt><strong><code>$theme</code></strong></dt>
<dd>
<p>The name of the <em>Email theme</em> used to hold template files. If the <a href="http://drupal.org/project/echo">Echo</a> module is enabled this theme will also be used to transform the message body into a fully-themed webpage.</p>
</dd>
<dt><strong><code>$theme_path</code></strong></dt>
<dd>
<p>The relative path to the selected <em>Email theme</em> directory.</p>
</dd>
<dt><strong><code>$theme_url</code></strong></dt>
<dd>
<p>The absolute URL to the selected <em>Email theme</em> directory.</p>
</dd>
<dt><strong><code>$debug</code></strong></dt>
<dd>
<p><code>TRUE</code> to add some useful debugging info to the bottom of the message.</p>
</dd>
</dl>
<p>Other modules may also add or modify theme variables by implementing a <code>MODULENAME_preprocess_htmlmail(&amp;$variables)</code> <a href="http://api.drupal.org/api/drupal/modules--system--theme.api.php/function/hook_preprocess_HOOK/7">hook function</a>.</p>',
array('!Instructions' => '')
),
);
$form['template']['htmlmail_debug'] = array(
'#type' => 'checkbox',
'#prefix' => '<br />',
'#title' => '<em>' . t('(Optional)') . '</em> ' . t('Debug'),
'#default_value' => variable_get('htmlmail_debug', '0'),
'#description' => t('Add debugging info (Set <code>$debug</code> to <code>TRUE</code>).'),
);
$form['theme'] = array(
'#type' => 'fieldset',
'#title' => t('Step 2'),
'#collapsible' => FALSE,
);
$form['theme']['htmlmail_theme'] = array(
'#type' => 'select',
'#title' => t('Email theme'),
'#default_value' => variable_get('htmlmail_theme', ''),
'#options' => htmlmail_get_allowed_themes(),
'#suffix' => '<p>'
. t('Choose the theme that will hold your customized templates from Step 1 above.')
. '</p><p>'
. (module_exists('echo') ?
t('The templated text will be styled by your chosen theme. This lets you use any one of <a href="!themes">over 800</a> themes to style your messages. Creating an email-specific sub-theme lets you use the full power of the <a href="!theme_system">drupal theme system</a> to format your messages.',
array(
'!themes' => 'http://drupal.org/project/themes',
'!theme_system' => 'http://drupal.org/documentation/theme',
)
) :
t('If you install and enable the <a href="!echo">Echo</a> module, the theme you select will also be used to style your messages as if they were pages on your website.',
array(
'!echo' => 'http://drupal.org/project/echo'
)
)
)
. '</p><p>'
. (module_exists('mailmime') ?
t('Since you have the <a href="!mailmime">Mail MIME</a> module installed, your images will be automatically converted to inline attachments, and a plain-text alternative will be available to recipients who prefer it.',
array('!mailmime' => 'http://drupal.org/project/mailmime')
) :
t('If you install the <a href="!mailmime">Mail MIME</a> module, images in your emails will be automatically converted to inline attachments, and a plain-text alternative will be made available. This prevents your recipients from seeing broken image links and scary security warnings when they don\'t have the sender\'s address in their email addressbook. <a href="!mailmime">Mail MIME</a> also allows <a href="!htmlmail">HTML Mail</a> to handle MIME-formatted messages sent by other modules such as <a href="!print">Send by-email</a>.',
array(
'!mailmime' => 'http://drupal.org/project/mailmime',
'!print' => 'http://drupal.org/project/print',
)
)
)
. '</p>',
);
$form['filter'] = array(
'#type' => 'fieldset',
'#title' => t('Step 3'),
'#collapsible' => FALSE,
);
$form['filter']['htmlmail_postfilter'] = array(
'#type' => 'select',
'#title' => t('Post-filtering'),
'#default_value' => variable_get('htmlmail_postfilter', ''),
'#options' => $formats,
'#suffix' => '<p>'
. t('You may choose a <a href="!formats">text format</a> to be used for filtering email messages <em>after</em> theming. This allows you to use any combination of <a href="!filters">over 200 filter modules</a> to make final changes to your message before sending.',
array(
'!formats' => url('admin/config/content/formats'),
'!filters' => url('http://drupal.org/project/modules/?filters=type%3Aproject_project%20tid%3A63%20hash%3A1hbejm%20-bs_project_sandbox%3A1%20bs_project_has_releases%3A1'),
)
)
. '</p><p>'
. t('Here is a recommended configuration:')
. '</p><ul><li><dl><dt>'
. t('<a href="!emogrifier">Emogrifier</a>',
array('!emogrifier' => url('http://drupal.org/project/emogrifier'))
)
. '</dt><dd>'
. t('Converts stylesheets to inline style rules for consistent display on mobile devices and webmail.')
. '</dd></dl></li><li><dl><dt>'
. t('<a href="!transliteration">Transliteration</a>',
array('!transliteration' => url('http;//drupal.org/project/filter_transliteration'))
)
. '</dt><dd>'
. t('Converts non-ASCII text to US-ASCII equivalents. This helps prevent Microsoft <q>smart-quotes</q> from appearing as question-marks in Mozilla Thunderbird.'
)
. '</dd></dl></li><li><dl><dt>'
. t('<a href="!pathologic">Pathologic</a>',
array('!pathologic' => url('http://drupal.org/project/pathologic'))
)
. '</dt><dd>'
. t('Converts relative URLS to absolute URLS so that clickable links in your message will work as intended.')
. '</dd></dl></ul>'
);
return system_settings_form($form);
}
/**
* Builds a form for sending a test message.
*/
function htmlmail_test_form($form_values = NULL) {
$defaults = variable_get(
'htmlmail_test',
array(
'to' => variable_get('site_mail', 'user@example.com'),
'subject' => 'test',
'body' => array(
'value' => 'test',
),
)
);
$defaults['body']['format'] = filter_fallback_format();
$form['to'] = array(
'#type' => 'textfield',
'#title' => t('To'),
'#default_value' => $defaults['to'],
'#maxlength' => 128,
'#required' => TRUE,
);
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $defaults['subject'],
'#maxlength' => 128,
'#required' => TRUE,
);
$form['body'] = array(
'#type' => 'text_format',
'#title' => t('Body'),
'#rows' => 20,
'#default_value' => $defaults['body']['value'],
'#format' => $defaults['body']['format'],
'#required' => TRUE,
);
$mailsystem = mailsystem_get();
if (empty($mailsystem['htmlmail'])) {
$mailsystem['htmlmail'] = 'HTMLMailSystem';
}
$form['class'] = array(
'#type' => 'select',
'#title' => t('Test mail sending class'),
'#default_value' => $mailsystem['htmlmail'],
'#options' => array_combine(mailsystem_get_classes(), mailsystem_get_classes()),
'#description' => 'Select the MailSystemInterface implementation to be tested.',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send test message'),
);
return $form;
}
/**
* Sends the test messsage and saves the contents for re-use.
*/
function htmlmail_test_form_submit($form, &$form_state) {
// Get the form values.
$defaults = array(
'to' => $form_state['values']['to'],
'subject' => $form_state['values']['subject'],
'body' => $form_state['values']['body'],
);
// Set the defaults for reuse.
variable_set('htmlmail_test', $defaults);
// Set the mail sending class.
mailsystem_set(array('htmlmail' => $form_state['values']['class']));
// Send the email.
$params = array(
'subject' => $form_state['values']['subject'],
'body' => check_markup(
$form_state['values']['body']['value'],
$form_state['values']['body']['format']
),
);
if (
drupal_mail(
'htmlmail',
'test',
$form_state['values']['to'],
language_default(),
$params
)
) {
drupal_set_message(t('HTML Mail test message sent.'));
}
}

View File

@@ -0,0 +1,15 @@
package = Mail
name = HTML Mail
description = Enables HTML in system emails.
php = 5.0
files[] = htmlmail.mail.inc
dependencies[] = mailsystem
core = 7.x
configure = admin/config/system/htmlmail
; Information added by drupal.org packaging script on 2012-04-05
version = "7.x-2.65"
core = "7.x"
project = "htmlmail"
datestamp = "1333660850"

View File

@@ -0,0 +1,112 @@
<?php
/**
* @file
* Installation for HTML Mail module.
*/
/**
* Implements hook_requirements().
*
* Ensures that the Mail System module is available, and
* that HTML Mail uses its own MailSystemInterface class.
*/
function htmlmail_requirements($phase) {
$result = array();
if ($phase === 'install') {
return $result;
}
if (module_load_include('inc', 'mailsystem', 'html_to_text') !== FALSE) {
return $result;
}
$args = array(
'%htmlmail' => 'HTML Mail',
'!htmlmail' => 'http://drupal.org/project/htmlmail',
'%mailsystem' => 'Mail System',
'!mailsystem' => 'http://drupal.org/project/mailsystem',
);
$result['htmlmail_mailsystem'] = array(
'title' => t('%mailsystem module', $args),
'value' => t('7.x-1.x'),
'description' => t(
'<a href="!htmlmail">%htmlmail</a> new requires <a href="!mailsystem">%mailsystem</a> 7.x-2.6 or later. Please download and install a recent version of <a href+"!mailsystem">%mailsystem</a>, then re-enable the <a href="!htmlmail">%htmlmail</a> module.', $args
),
'severity' => REQUIREMENT_ERROR,
);
return $result;
}
/**
* Implements hook_update_N().
*
* Removes variables that are no longer used.
*/
function htmlmail_update_7200() {
variable_del('htmlmail_header');
variable_del('htmlmail_footer');
variable_del('htmlmail_css');
}
/**
* Implements hook_update_N().
*
* Rename HTMLMailMailSystem to HTMLMailSystem.
*/
function htmlmail_update_7201() {
module_load_include('module', 'mailsystem');
foreach (mailsystem_get() as $name => $value) {
if ($value == 'HTMLMailMailSystem') {
mailsystem_set(array($name => 'HTMLMailSystem'));
}
}
}
/**
* Implements hook_update_N().
*
* Increase module weight so dependent modules get loaded first.
*/
function htmlmail_update_7202() {
db_query("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'htmlmail'");
}
function htmlmail_update_7203() {
if ($requirements = htmlmail_requirements('runtime')) {
$requirement = array_shift($requirements);
throw new DrupalUpdateException($requirement['description']);
}
}
/**
* Implements hook_enable().
*/
function htmlmail_enable() {
module_load_include('module', 'mailsystem');
mailsystem_set(array('htmlmail' => 'HTMLMailSystem'));
}
/**
* Implements hook_disable().
*/
function htmlmail_disable() {
// Check is necessary because a 7.x-1.x to 7.x-2.x upgrade
// may not have mailsystem installed.
if (function_exists('mailsystem_clear')) {
mailsystem_clear(array('htmlmail' => 'HTMLMailSystem'));
}
}
/**
* Implements hook_install().
*/
function htmlmail_install() {
htmlmail_update_7202();
}
/**
* Implements hook_uninstall().
*/
function htmlmail_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'htmlmail_%'");
cache_clear_all('variables', 'cache');
}

View File

@@ -0,0 +1,322 @@
<?php
/**
* @file
* Formats and sends mail using the MailMIME class.
*
* @see http://drupal.org/node/900794
* @see http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7
* @see http://drupal.org/project/mailmime
*/
/**
* Implements MailSystemInterface.
*/
class HTMLMailSystem implements MailSystemInterface {
/**
* Format emails according to module settings.
*
* Parses the message headers and body into a MailMIME object. If another module
* subsequently modifies the body, then format() should be called again before
* sending. This is safe because the $message['body'] is not modified.
*
* @param $message
* An associative array with at least the following parts:
* - headers: An array of (name => value) email headers.
* - body: The text/plain or text/html message part.
*
* @return
* The formatted $message, ready for sending.
*/
public function format(array $message) {
$eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
// @todo Remove this when issue #209672 gets resolved.
$default_from = variable_get('site_mail', ini_get('sendmail_from'));
if ( !empty($message['headers']['From'])
&& $message['headers']['From'] == $default_from
&& valid_email_address($default_from)
) {
$message['headers']['From'] = '"'
. str_replace('"', '', variable_get('site_name', 'Drupal'))
. '" <' . $default_from . '>';
}
// Collapse the message body array.
if (module_exists('mailmime')) {
$body = $this->formatMailMIME($message);
$plain = $message['MailMIME']->getTXTBody();
}
else {
if (is_array($message['body'])) {
$message['body'] = implode("<br />$eol<br />$eol", $message['body']);
}
$body = theme('htmlmail', $message);
if ($message['body'] && !$body) {
watchdog(
'htmlmail',
'The %theme function did not return any text. Please check your template file for errors.',
array('%theme' => "theme('htmlmail', \$message)"),
WATCHDOG_WARNING
);
$body = $message['body'];
}
// @todo Change to drupal_html_to_text when issue #299138 gets resolved.
$plain = mailsystem_html_to_text($body);
if ($body && !$plain) {
watchdog(
'htmlmail',
'The %convert function did not return any text. Please report this error to the %mailsystem issue queue.',
array('%convert' => 'mailsystem_html_to_text()', '%mailsystem' => 'Mail system'),
WATCHDOG_WARNING,
'http://drupal.org/node/add/project-issue/mailsystem'
);
}
}
// Check to see whether recipient allows non-plaintext.
if ($body && htmlmail_is_allowed($message['to'])) {
// Optionally apply the selected web theme.
if (module_exists('echo') && $theme = htmlmail_get_selected_theme($message)) {
$themed_body = echo_themed_page($message['subject'], $body, $theme);
if ($themed_body) {
$body = $themed_body;
}
else {
watchdog(
'htmlmail',
'The %echo function did not return any text. Please check the page template of your %theme theme for errors.',
array('%echo' => 'echo_themed_page()', '%theme' => $theme),
WATCHDOG_WARNING
);
}
}
// Optionally apply the selected output filter.
if ($filter = variable_get('htmlmail_postfilter')) {
$filtered_body = check_markup($body, $filter);
if ($filtered_body) {
$body = $filtered_body;
}
else {
watchdog(
'htmlmail',
'The %check function did not return any text. Please check your %filter output filter for errors.',
array('%check' => 'check_markup()', '%filter' => $filter),
WATCHDOG_WARNING
);
}
}
// Store the fully-themed HTML body.
if (isset($message['MailMIME'])) {
$mime = &$message['MailMIME'];
$mime->setHTMLBody($body);
list($message['headers'], $message['body']) = $mime->toEmail($message['headers']);
if (!$message['body']) {
watchdog(
'htmlmail',
'The %toemail function did not return any text. Please report this errot to the %mailmime issue queue.',
array('%toemail' => 'MailMIME::toEmail()', '%mailmime' => 'Mail MIME'),
WATCHDOG_WARNING,
'http://drupal.org/node/add/project-issue/mailmime'
);
}
}
else {
$message['headers']['Content-Type'] = 'text/html; charset=utf-8';
$message['body'] = $body;
}
}
else {
if (isset($message['MailMIME'])) {
$mime = &$message['MailMIME'];
$mime->setHTMLBody('');
$mime->setContentType('text/plain', array('charset' => 'utf-8'));
list($message['headers'], $message['body']) = $mime->toEmail($message['headers']);
if (!$message['body']) {
watchdog(
'htmlmail',
'The %toemail function did not return any text. Please report this errot to the %mailmime issue queue.',
array('%toemail' => 'MailMIME::toEmail()', '%mailmime' => 'Mail MIME'),
WATCHDOG_WARNING,
'http://drupal.org/node/add/project-issue/mailmime'
);
}
}
else {
$message['body'] = $plain;
$message['headers']['Content-Type'] = 'text/plain; charset=utf-8';
}
}
return $message;
}
/**
* Use the MailMime class to format the message body.
*
* @see http://drupal.org/project/mailmime
*/
public function formatMailMIME(array &$message) {
$eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
$message['body'] = MailMIME::concat($message['body']);
// Build a full email message string.
$email = MailMIME::encodeEmail($message['headers'], $message['body']);
// Parse it into MIME parts.
if (!($mime = MailMIME::parse($email))) {
watchdog(
'HTMLMailSystem',
'Could not parse email message.',
array(),
WATCHDOG_ERROR
);
return $message;
}
// Work on a copy so that the original $message['body'] remains unchanged.
$email = $message;
if ( !($email['body'] = $mime->getHTMLBody())
&& !($email['body'] = $mime->getTXTBody())
) {
$email['body'] = '';
}
else {
// Wrap formatted plaintext in <pre> tags.
if ( $email['body'] === strip_tags($email['body']) // No html tags.
&& preg_match('/.' . $eol . './', $email['body']) // At least one embedded newline.
) {
$email['body'] = '<pre>' . $email['body'] . '</pre>';
}
}
// Theme with htmlmail.tpl.php.
$body = theme('htmlmail', $email);
$mime->setHTMLBody($body);
// @todo Change to drupal_html_to_text when issue #299138 gets resolved.
$mime->setTXTBody(mailsystem_html_to_text($body));
$message['MailMIME'] = &$mime;
return $body;
}
/**
* Send an email message.
*
* @param $message
* An associative array containing at least:
* - headers: An associative array of (name => value) email headers.
* - body: The text/plain or text/html message body.
* - MailMIME: The message, parsed into a MailMIME object.
*/
public function mail(array $message) {
$eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
// Ensure that subject is non-null.
$message += array('subject' => t('(No subject)'));
// Check for empty recipient.
if (empty($message['to'])) {
if (empty($message['headers']['To'])) {
watchdog(
'HTMLMailSystem',
'Cannot send email about %subject without a recipient.',
array('subject' => $message['subject']),
WATCHDOG_ERROR
);
return FALSE;
}
$message['to'] = $message['headers']['To'];
}
if (class_exists('MailMIME')) {
$mime = new MailMIME();
$to = $mime->encodeHeader('to', $message['to']);
$subject = $mime->encodeHeader('subject', $message['subject']);
$txt_headers = $mime->txtHeaders($message['headers']);
}
else {
$to = mime_header_encode($message['to']);
$subject = mime_header_encode($message['subject']);
$txt_headers = $this->txtHeaders($message['headers']);
}
$body = preg_replace('#(\r\n|\r|\n)#s', $eol, $message['body']);
// Check for empty body.
if (empty($body)) {
watchdog(
'HTMLMailSystem',
'Refusing to send a blank email to %recipient about %subject.',
array('%recipient' => $message['to'], '%subject' => $message['subject']),
WATCHDOG_WARNING
);
return FALSE;
}
if (variable_get('htmlmail_debug', 0)) {
$params = array(
$to,
$subject,
drupal_substr($body, 0, min(80, strpos("\n", $body))) . '...',
$txt_headers
);
}
if (isset($message['headers']['Return-Path'])) {
// A return-path was set.
if (isset($_SERVER['WINDIR']) || strpos($_SERVER['SERVER_SOFTWARE'], 'Win32') !== FALSE) {
// On Windows, PHP will use the value of sendmail_from for the
// Return-Path header.
$old_from = ini_get('sendmail_from');
ini_set('sendmail_from', $message['headers']['Return-Path']);
$result = @mail($to, $subject, $body, $txt_headers);
ini_set('sendmail_from', $old_from);
}
elseif (ini_get('safe_mode')) {
// If safe mode is in effect, passing the fifth parameter to @mail
// will cause it to return FALSE and generate a PHP warning, even
// if the parameter is NULL.
$result = @mail($to, $subject, $body, $txt_headers);
}
else {
// On most non-Windows systems, the "-f" option to the sendmail command
// is used to set the Return-Path.
$extra = '-f' . $message['headers']['Return-Path'];
$result = @mail($to, $subject, $body, $txt_headers, $extra);
if (variable_get('htmlmail_debug', 0)) {
$params[] = $extra;
}
}
}
else {
// No return-path was set.
$result = @mail($to, $subject, $body, $txt_headers);
}
if (!$result && variable_get('htmlmail_debug', 0)) {
$call = '@mail(' . implode(', ', $params) . ')';
foreach ($params as $i => $value) {
$params[$i] = var_export($value, 1);
}
if (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) {
$trace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 1);
}
else {
$trace = debug_backtrace(0);
for ($i = count($trace) - 1; $i >= 0; $i--) {
unset($trace[$i]['args']);
}
$trace = print_r($trace);
}
watchdog('htmlmail', 'Mail sending failed because:<br /><pre>@call</pre><br />returned FALSE.<br /><pre>@trace</pre>', array('@call' => $call, '@trace' => $trace));
}
return $result;
}
/**
* Converts an array of email headers to a text string.
*
* @param $headers
* An associative array of ('HeaderName' => 'header value') pairs.
*
* @return
* The concatenated headers as a single string.
*/
public function txtHeaders(array $headers) {
$output = array();
foreach ($headers as $name => $value) {
if (is_array($value)) {
foreach ($value as $val) {
$output[] = "$name: $val";
}
}
else {
$output[] = "$name: $value";
}
}
return implode("\n", $output);
}
}

View File

@@ -0,0 +1,92 @@
When formatting an email message with a given `$module` and `$key`,
[HTML Mail](http://drupal.org/project/htmlmail)
will use the first template file it finds from the following list:
1. `htmlmail--$module--$key.tpl.php`
2. `htmlmail--$module.tpl.php`
3. `htmlmail.tpl.php`
For each filename,
[HTML Mail](http://drupal.org/project/htmlmail)
looks first in the chosen *Email theme* directory, then in its own
module directory, before proceeding to the next filename.
For example, if `example_module` sends mail with:
drupal_mail("example_module", "outgoing_message" ...)
the possible template file names would be:
1. `htmlmail--example_module--outgoing_message.tpl.php`
2. `htmlmail--example_module.tpl.php`
3. `htmlmail.tpl.php`
Template files are cached, so remember to clear the cache by visiting
<u>admin/config/development/performance</u>
after changing any `.tpl.php` files.
The following variables available in this template:
**`$body`**
: The message body text.
**`$module`**
: The first argument to
[`drupal_mail()`](http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7),
which is, by convention, the machine-readable name of the sending module.
**`$key`**
: The second argument to
[`drupal_mail()`](http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7),
which should give some indication of why this email is being sent.
**`$message_id`**
: The email message id, which should be equal to `"{$module}_{$key}"`.
**`$headers`**
: An array of email `(name => value)` pairs.
**`$from`**
: The configured sender address.
**`$to`**
: The recipient email address.
**`$subject`**
: The message subject line.
**`$body`**
: The formatted message body.
**`$language`**
: The language object for this message.
**`$params`**
: Any module-specific parameters.
**`$template_name`**
: The basename of the active template.
**`$template_path`**
: The relative path to the template directory.
**`$template_url`**
: The absolute URL to the template directory.
**`$theme`**
: The name of the *Email theme* used to hold template files. If the
[Echo](http://drupal.org/project/echo) module is enabled this theme will
also be used to transform the message body into a fully-themed webpage.
**`$theme_path`**
: The relative path to the selected *Email theme* directory.
**`$theme_url`**
: The absolute URL to the selected *Email theme* directory.
**`$debug`**
: `TRUE` to add some useful debugging info to the bottom of the message.
Other modules may also add or modify theme variables by implementing a
`MODULENAME_preprocess_htmlmail(&$variables)`
[hook function](http://api.drupal.org/api/drupal/modules--system--theme.api.php/function/hook_preprocess_HOOK/7).

View File

@@ -0,0 +1,233 @@
<?php
/**
* @file
* Sends system emails in HTML.
*/
/**
* Implements hook_permission().
*
* Defines a permission for setting the per-user plaintext option.
*/
function htmlmail_permission() {
$args = array(
'!htmlmail' => url('http://drupal.org/project/htmlmail'),
'%htmlmail' => 'HTML Mail',
);
return array(
'choose htmlmail_plaintext' => array(
'title' => t('Choose to receive plaintext emails via %htmlmail', $args),
'description' => t(
'Granting this permission allows users to choose whether to receive all their emails in plaintext, rather than the default format provided by the <a href="!htmlmail">%htmlmail</a> module.', $args
),
),
);
}
/**
* Implements hook_help().
*/
function htmlmail_help($path, $arg) {
switch ($path) {
case 'admin/config/system/htmlmail':
return '<h2>' . t('Theming') . '</h2><p>' . t('The email message goes through three transformations before sending:') . '</p>';
case 'admin/help#htmlmail':
return '<p>'
. t('<a href="!htmlmail">HTML Mail</a> lets you theme your messages the same way you theme the rest of your website.',
array('!htmlmail' => 'http://drupal.org/project/htmlmail')
) . '</p>';
default:
return '';
}
}
/**
* Implements hook_menu().
*/
function htmlmail_menu() {
$items['admin/config/system/htmlmail'] = array(
'title' => 'HTML Mail',
'description' => 'Configure HTML Mail system-wide settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array('htmlmail_admin_settings'),
'access arguments' => array('administer site configuration'),
'file' => 'htmlmail.admin.inc',
);
$items['admin/config/system/htmlmail/settings'] = array(
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => '-2'
);
$items['admin/config/system/htmlmail/test'] = array(
'title' => 'Send Test',
'page callback' => 'drupal_get_form',
'page arguments' => array('htmlmail_test_form'),
'access arguments' => array('access administration pages'),
'type' => MENU_LOCAL_TASK,
'file' => 'htmlmail.admin.inc',
);
return $items;
}
/**
* Implements hook_theme().
*
* Auto-detects htmlmail template files in the selected theme and in the
* htmlmail module directory.
*/
function htmlmail_theme() {
$items = array();
$module_path = drupal_get_path('module', 'htmlmail');
$pattern = '/^htmlmail.*\.tpl\.php$/';
$files = file_scan_directory($module_path, $pattern, array('key' => 'name'));
if ($theme = htmlmail_get_selected_theme()) {
$theme_path = drupal_get_path('theme', $theme);
$files = array_merge($files,
file_scan_directory($theme_path, $pattern, array('key' => 'name'))
);
}
else {
$theme_path = $module_path;
}
ksort($files);
foreach ($files as $file) {
$path = dirname($file->uri);
$template = substr($file->name, 0, -4);
$suggestion = str_replace('--', '__', $template);
$items[$suggestion] = array(
'variables' => array('message' => array()),
'template' => $template,
'path' => $path,
'theme path' => $theme_path,
);
}
return $items;
}
/**
* Process variables to format email messages.
*
* @see htmlmail.tpl.php
*/
function template_preprocess_htmlmail(array &$variables) {
$variables['debug'] = variable_get('htmlmail_debug', '0');
$variables['theme'] = htmlmail_get_selected_theme($variables);
$variables['module_path'] = drupal_get_path('module', 'htmlmail');
if (empty($variables['theme'])) {
$variables['theme'] = 'no theme';
$variables['theme_path'] = $variables['module_path'];
}
else {
$variables['theme_path'] = drupal_get_path('theme', $variables['theme']);
}
$variables['theme_url'] = url(
$variables['theme_path'], array('absolute' => TRUE)
);
$variables['message_id'] = $variables['module'] . '_' . $variables['key'];
$suggestion = 'htmlmail__' . $variables['module'];
$variables['theme_hook_suggestions'][] = $suggestion;
$suggestion .= '__' . $variables['key'];
$variables['theme_hook_suggestions'][] = $suggestion;
}
/**
* Implements hook_mail().
*/
function htmlmail_mail($key, &$message, $params) {
$message['module'] = 'htmlmail';
$message['key'] = $key;
$message['subject'] = $params['subject'];
$message['body'] = explode(
MAIL_LINE_ENDINGS . MAIL_LINE_ENDINGS,
$params['body']
);
return $message;
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function htmlmail_form_user_profile_form_alter(&$form, &$form_state) {
if ($form['#user_category'] != 'account') {
return;
}
if (!(user_access('choose htmlmail_plaintext') || user_access('administer users'))) {
return;
}
$account = $form['#user'];
$mail = $form['account']['mail'];
$form['account']['mail'] = array(
'mail' => $mail,
'htmlmail_plaintext' => array(
'#type' => 'checkbox',
'#title' => t('Plaintext-only emails'),
'#default_value' => empty($account->data['htmlmail_plaintext']) ? 0 : 1,
'#description' => t('The %htmlmail module can send emails with fonts, styles, and other HTML formatting. If you prefer to receive all your emails in unformatted plain text, select this option.',
array('%htmlmail' => 'HTML Mail')
),
),
);
}
/**
* Implements hook_user_presave().
*/
function htmlmail_user_presave(&$edit, $account, $category) {
if (user_access('choose htmlmail_plaintext') || user_access('administer users')) {
$edit['data']['htmlmail_plaintext'] = empty($edit['htmlmail_plaintext']) ? 0 : 1;
unset($edit['htmlmail_plaintext']);
}
}
/**
* Returns an associative array of allowed themes. The keys are the
* machine-readable names and the values are the .info file names.
* Based on code from the og_theme module.
*/
function &htmlmail_get_allowed_themes() {
$allowed = &drupal_static(__FUNCTION__);
if (!isset($allowed)) {
$allowed = array('' => t('No theme'));
$themes = list_themes();
module_load_include('inc', 'system', 'system.admin');
uasort($themes, 'system_sort_modules_by_info_name');
foreach ($themes as $key => $value) {
if ($value->status) {
$allowed[$key] = check_plain($value->info['name']);
}
}
}
return $allowed;
}
/**
* Returns the selected theme to use for outgoing emails.
*/
function htmlmail_get_selected_theme(&$message = array()) {
$selected = isset($message['theme'])
? $message['theme'] : variable_get('htmlmail_theme', '');
if ($selected) {
// Make sure the selected theme is allowed.
$themes = &htmlmail_get_allowed_themes();
if (empty($themes[$selected])) {
$selected = '';
}
}
return $selected;
}
/**
* Checks whether a given recipient email prefers plaintext-only messages.
*
* @param $email
* The recipient email address.
*
* @return
* FALSE if the recipient prefers plaintext-only messages; otherwise TRUE.
*/
function htmlmail_is_allowed($email) {
return !($recipient = user_load_by_mail($email))
|| empty($recipient->data['htmlmail_plaintext']);
}

View File

@@ -0,0 +1,178 @@
<?php
/**
* @file
* Default template for HTML Mail
*
* DO NOT EDIT THIS FILE. Copy it to your theme directory, and edit the copy.
*
* ========================================================= Begin instructions.
*
* When formatting an email message with a given $module and $key, [1]HTML
* Mail will use the first template file it finds from the following list:
* 1. htmlmail--$module--$key.tpl.php
* 2. htmlmail--$module.tpl.php
* 3. htmlmail.tpl.php
*
* For each filename, [2]HTML Mail looks first in the chosen Email theme
* directory, then in its own module directory, before proceeding to the
* next filename.
*
* For example, if example_module sends mail with:
* drupal_mail("example_module", "outgoing_message" ...)
*
*
* the possible template file names would be:
* 1. htmlmail--example_module--outgoing_message.tpl.php
* 2. htmlmail--example_module.tpl.php
* 3. htmlmail.tpl.php
*
* Template files are cached, so remember to clear the cache by visiting
* admin/config/development/performance after changing any .tpl.php files.
*
* The following variables available in this template:
*
* $body
* The message body text.
*
* $module
* The first argument to [3]drupal_mail(), which is, by convention,
* the machine-readable name of the sending module.
*
* $key
* The second argument to [4]drupal_mail(), which should give some
* indication of why this email is being sent.
*
* $message_id
* The email message id, which should be equal to
* "{$module}_{$key}".
*
* $headers
* An array of email (name => value) pairs.
*
* $from
* The configured sender address.
*
* $to
* The recipient email address.
*
* $subject
* The message subject line.
*
* $body
* The formatted message body.
*
* $language
* The language object for this message.
*
* $params
* Any module-specific parameters.
*
* $template_name
* The basename of the active template.
*
* $template_path
* The relative path to the template directory.
*
* $template_url
* The absolute URL to the template directory.
*
* $theme
* The name of the Email theme used to hold template files. If the
* [5]Echo module is enabled this theme will also be used to
* transform the message body into a fully-themed webpage.
*
* $theme_path
* The relative path to the selected Email theme directory.
*
* $theme_url
* The absolute URL to the selected Email theme directory.
*
* $debug
* TRUE to add some useful debugging info to the bottom of the
* message.
*
* Other modules may also add or modify theme variables by implementing a
* MODULENAME_preprocess_htmlmail(&$variables) [6]hook function.
*
* References
*
* 1. http://drupal.org/project/htmlmail
* 2. http://drupal.org/project/htmlmail
* 3. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7
* 4. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail/7
* 5. http://drupal.org/project/echo
* 6. http://api.drupal.org/api/drupal/modules--system--theme.api.php/function/hook_preprocess_HOOK/7
*
* =========================================================== End instructions.
*/
$template_name = basename(__FILE__);
$current_path = realpath(NULL);
$current_len = strlen($current_path);
$template_path = realpath(dirname(__FILE__));
if (!strncmp($template_path, $current_path, $current_len)) {
$template_path = substr($template_path, $current_len + 1);
}
$template_url = url($template_path, array('absolute' => TRUE));
?>
<div class="htmlmail-body">
<?php echo $body; ?>
</div>
<?php if ($debug):
$module_template = "htmlmail--$module.tpl.php";
$message_template = "htmlmail--$module--$key.tpl.php";
?>
<hr />
<div class="htmlmail-debug">
<dl><dt><p>
To customize this message:
</p></dt><dd><ol><li><p><?php if (empty($theme)): ?>
Visit <u>admin/config/system/htmlmail</u>
and select a theme to hold your custom email template files.
</p></li><li><p><?php elseif (empty($theme_path)): ?>
Visit <u>admin/appearance</u>
to enable your selected
<u><?php echo drupal_ucfirst($theme); ?></u> theme.
</p></li><li><?php endif;
if ("$template_path/$template_name" == "$theme_path/$message_template"): ?><p>
Edit your<br />
<code><?php echo "$template_path/$template_name"; ?></code>
<br />file.
</p></li><li><?php
else:
if (!file_exists("$theme_path/htmlmail.tpl.php")): ?><p>
Copy<br />
<code><?php echo "$module_path/htmlmail.tpl.php"; ?></code>
<br />to<br />
<code><?php echo "$theme_path/htmlmail.tpl.php"; ?></code>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$module_template")): ?><p>
For module-specific customization, copy<br />
<code><?php echo "$module_path/htmlmail.tpl.php"; ?></code>
<br />to<br />
<code><?php echo "$theme_path/$module_template"; ?></code>
</p></li><li><?php
endif;
if (!file_exists("$theme_path/$message_template")): ?><p>
For message-specific customization, copy<br />
<code><?php echo "$module_path/htmlmail.tpl.php"; ?></code>
<br />to<br />
<code><?php echo "$theme_path/$message_template"; ?></code>
</p></li><li><?php endif; ?><p>
Edit the copied file.
</p></li><li><?php
endif; ?><p>
Send a test message to make sure your customizations worked.
</p></li><li><p>
If you think your customizations would be of use to others,
please contribute your file as a feature request in the
<a href="http://drupal.org/node/add/project-issue/htmlmail">issue queue</a>.
</p></li></ol></dd><?php if (!empty($params)): ?><dt><p>
The <?php echo $module; ?> module sets the <u><code>$params</code></u>
variable. For this message,
</p></dt><dd><p><code><pre>
$params = <?php echo check_plain(print_r($params, 1)); ?>
</pre></code></p></dd><?php endif; ?></dl>
</div>
<?php endif;