Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Sending a plain text newsletter


Go to End


9 Posts   4272 Views

Avatar
SilverRay

Community Member, 167 Posts

26 June 2009 at 12:51am

I'm trying to send a plain text newsletter using the newsletter module. No matter what I do, even if I make all the send() functions in the newsletter module's code into sendPlain(), it still send out email with a mime part, like this:

This is a multi-part message in MIME format.

------=_NextPart_198359570119
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<p>This is a draft newsletter.</p>
------=_NextPart_198359570119--

How can I make it so, that it sends out some old-fashioned text email? Thanks!

Avatar
_Vince

Community Member, 165 Posts

24 July 2009 at 10:15am

*bump*

I am having the same problem myself.

Can anyone tell me what's wrong?

Avatar
_Vince

Community Member, 165 Posts

6 October 2009 at 1:34pm

Anybody..?

Avatar
freedolin

Community Member, 6 Posts

6 October 2009 at 10:31pm

Hi _Vince

try to create a second newsletter template. I guess this one will be in plain text.

I raised that issue some time ago, but unfortunately without any responses.

See here: http://silverstripe.org/all-other-modules/show/266217

Avatar
_Vince

Community Member, 165 Posts

6 October 2009 at 10:38pm

Freedolin:

Thanks for replying and yes, I've seen your post from a while back while I was looking for a solution.

I don't understand your comment though: I can't create a second template in plain text because I can't have two files with the same name in the templates directory. Or am I missing something?

I've managed to get a template happening but the email arrives blank. Unless I *don't* use a template, in which case Outlook displays all the tags. :P

Not a very good day.

Avatar
freedolin

Community Member, 6 Posts

6 October 2009 at 10:48pm

What I intended to say is:
1) Make one template. (you have already one)
2) Copy it and rename it.

Now you have obviously two templates.

If one sends a test newsletter using the 1st template then it will be HTML.
If one sends a test newsletter using the 2nd template then it will be plain text.

I underline: both templates are HTML-templates. Their only difference is their name.

Avatar
_Vince

Community Member, 165 Posts

7 October 2009 at 12:15am

Ahh... Now I understand. Thanks for the suggestion.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 October 2009 at 1:07am

Just a heads up, I was dealing with this the other day and I discovered there's a bug in Silverstripe that will not allow you to send a plain text email. At least not through the Email class.

The problem is the $attachedFiles property. The default value in the class is

protected $attachedFiles = array();

But in the sendPlain() function, there's a check for attached files

if(is_array($attachedFiles))
// change the content-type to "multipart"

It should be checking if the array has a size -- not that it's just an array. Since the $attachedFiles property is protected, you can't modify its value from outside the class. Therefore, you're forced to have a multipart content-type.

I've sent the bug to Silverstripe.

Go to Top