Skip to Content.
Sympa Menu

en - RE: [sympa-users] Adding Link to Welcome Message

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Steve Shipway <address@concealed>
  • To: "address@concealed" <address@concealed>, "address@concealed" <address@concealed>
  • Subject: RE: [sympa-users] Adding Link to Welcome Message
  • Date: Sun, 17 Aug 2014 22:08:33 +0000

> I am running a mailing list on Riseup.net. I have a question about editing
> the
> welcome message that is automatically sent when people subscribe
> (welcome.tt2). Is it possible to add links to the welcome message? I have
> not
> been able to get HTML links to work when editing the welcome message
> template.

This is a little more complex than you might realise, as you need to change
the MIME type.

The welcome.tt2 template is a template for the entire email, including some
of
the headers. This will allow you to send a plain text email without too much
difficulty, which can of course contain URLs as text, which you can see in
the
default template you posted. How these show up in the mail reader depends on
the mail reader -- some will recognise URLs in a text message and make them
clickable. Many will just render them as text, and you probably want them
clickable.

To make these links clickable, you'll need to send an HTML email -- or, to be
safe, a MIME multipart/alternative email with both text and HTML parts. Now
we're getting a bit more complex, but it is still possible! You need to add
the additional MIME headers to make a two-part email. You can see how to do
this in the default modindex.tt2 template, but here's a cut-down example.
The
blank lines are required.

------- cut here -------
From: [% fromlist %]
Subject: [% FILTER qencode %][%|loc(list.name)%]Welcome to list
%1[%END%][%END
%]
Content-Type: multipart/alternative; boundary="[% boundary %]"

This is a multipart message in MIME format.

--[% boundary %]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

[%|loc%]The list homepage:[%END%] [% conf.wwsympa_url %]/info/[% list.name %]

--[% boundary %]
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<HTML><BODY>
<A HREF="[% conf.wwsympa_url %]/info/[% list.name %]">[%|loc%]The list
homepage:[%END%]</A>
</BODY></HTML>

--[% boundary %]--
---------- cut here ----------

What this does, is to use MIME format to specify two alternative messages;
one
in HTML and one in plain text. The mail reader software is expected to pick
the appropriate one depending on its capabilities and display it. The HTML
version has clickable links; the text version simply gives the URL as text.

The problem, of course, is if someone is using a very old mail client that
does not understand MIME encoding. In that case, they simply see the whole
thing, which is why there is the initial line telling them of the format,
and
you put the text/plain portion first. Whether or not you see this as a
problem is up to you and your potential list subscribers.

There is a separate issue with HTML links being embedded in the 'info' page.
These are stripped out for security reasons by WWSympa, though a very small
code modification can allow certain link types -- such as http, https and
mailto -- to be preserved. Hopefully, this can be a configurable option in
Sympa 6.2.

Steve

Steve Shipway
address@concealed


Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.19+.

Top of Page