soveZonen
Søg

Direct Mail

There is no front-end access to the Direct Mail extension; it is entirely a back-end module. This text is just a very brief summary of the process of creating a Newsletter. The documentation for Direct Mail (there are several extensions called Direct Mail... the one in use here has the extension key:direct_mail) is well written and extensive, so should you need more info, read it through.

Direct Mail Newsletters

Newsletters are just normal pages in the pagetree. They are however structured slightly differently; seeing as HTML mail is a complex beast of a topic, it's basically not possible to use "normal" HTML and CSS in an HTML mail. We have to get all pre-historic and use *gasp* tables. 

I've made a simple TV template that uses tables, called "Newsletter". Things to bear in  mind when redesigning it or modifying it, are that any images must have an absolute path. Relative paths won't work. Neither will CSS background images, not reliably. If you want to set a background image, set it in the "background" attribute of the "wrapper" table.

Included stylesheets, or any styles between <style> tags anwhere in the HTML will be stripped out by a lot of webmail providers (Gmail and hotmail in particular) which leaves us only with inline styles.

A complication of using inline styles with a CMS, is that specific elements can't be styled; we're at the mercy of the user agent's/email client's default styles. It's just the way it has to be...

All newsletter pages should be created inside the "DirectMail" SysFolder.

Using this method, it's not possible to reliably add a plain-text version, so this has been disabled. There are very few email clients that cannot render HTML mail; probably the userbase of such clients is < 1%.
 

Creating a Direct Mail

When the page has been created and its content completed and it's ready to be sent as a mail, it needs to be prepared for sending by Direct Mail. To do this, Click "Direct Mail" in the admin panel. This will start the Direct Mail wizard.

At step one, click "Internal Page" and then select the page that's going to be sent as an HTML mail, and click "Next".

At step two, verify the details, and either click "edit" to modify them, or click "Next" to continue.

At step three, you can select categories, but unless a large complex newsletter installation is required, categories won't be necessary, so just click "Next".

At step four, you can send a test mail to any mail address to confirm that the mail looks like it should. It's advisable to test this.

At step five, you can select which recipient list should recieve the mail, and at what date/time the mail should be sent. Click "Send to all subscribers in recipient list" to send the mail.

HTML Mail

It should be noted that Gmail doesn't support the cellpadding or cellspacing attributes in tables (Read).

A good article on HTML mails:

How to Code HTML Email Newsletters [HTML & XHTML Tutorials]

Important note about HTML mail

Because sending newsletters in plain-text is disabled, it means that allnewsletters are sent in HTML mail format. There's a field in the tt_address database (it is named module_sys_dmail_html) that specifies whether the user wants HTML mails or not. Each user must have this set to 1 by default, otherwise no HTML mails will be sent to them.

There is no TypoScript solution to this. And we can't rely on the user to keep the "Receive HTML mails?" box checked, so we can't allow them access to this setting.

The workaround is that I modified the EXT:sr_email_subscribe/ext_tables.sql file so that the default value for this field is 1 instead of 0. Therefore, if you need to update or otherwise reinstall the sr_email_subscribe extension, make sure you change this default value back to 1, otherwise newsletters will not be sent.

Setting up a cron job

To setup a cron job, use the Plesk control panel for the domain, and schedule a new task. Enter the details as shown in the image:

Make sure you replace the domain name in the command line with the correct domain. For example:

/var/www/vhosts/basispakke.dk/httpdocs/typo3conf/ext/direct_mail/res/scripts/dmailerd.phpcron

would become:

/var/www/vhosts/otherdomain.dk/httpdocs/typo3conf/ext/direct_mail/res/scripts/dmailerd.phpcron

The file also MUST have the following permissions set:

-rwxrwxr--

Otherwise it won't be executable, and won't run. Use Plesk to change the permissions.

Also, even though it says "Caution: Please check the cronjob or cronjob is not set." in the Direct Mail wizard, it is actually set. Schedule a test batch to be certain.