View previous topic :: View next topic |
Author |
Message |
williamholmgren
Joined: 13 Jun 2006 Posts: 6
|
Posted: Tue Jul 18, 2006 4:09 pm Post subject: notifications line breaking |
|
|
I'd like to use plain text rather than HTML in the notification emails that my blog sends out. However, I cannot find out how to add line breaks now that I've removed the HTML tags. Just adding carraige returns doesn't seem to do it. The gettext function seems to sometimes add line breaks, but not always?
Code: |
<%= gettext("{{title}}") %>
<%= gettext("--------------") %>
<%= gettext("{{body}}") %>
<%= gettext("-{{author}}") %>
{{if num_attachments}}<%= gettext("{{num_attachments}} attachment(s) accessible on the website") %>{{else}}{{/if}}
<%= gettext("Full article link:") %> {{permalink_url}}
|
and I end up with:
Code: |
more test -------------- test again
line breaks?
break?
-Will Full article link: http://... |
where "more test" was the title, "test again" the first line of the article, and then the rest of it.
Last edited by williamholmgren on Tue Jul 18, 2006 10:57 pm; edited 1 time in total |
|
Back to top |
|
|
williamholmgren
Joined: 13 Jun 2006 Posts: 6
|
Posted: Tue Jul 18, 2006 4:27 pm Post subject: |
|
|
Well, I seem to be unable to actually past in my code correctly. Is there a way to turn off the parsing? |
|
Back to top |
|
|
john Site Admin
Joined: 16 Mar 2004 Posts: 3434
|
Posted: Tue Jul 18, 2006 7:46 pm Post subject: |
|
|
williamholmgren wrote: | Well, I seem to be unable to actually past in my code correctly. Is there a way to turn off the parsing? |
This version of the forum software we are using seems to have trouble with certain formatting codes when HTML is enabled, unfortunately there's nothing we can do about it until they revise their software. Try editing your original post and checking the Disable HTML in this post checkbox and see if that comes out they way you'd expected. |
|
Back to top |
|
|
williamholmgren
Joined: 13 Jun 2006 Posts: 6
|
Posted: Tue Jul 18, 2006 10:58 pm Post subject: |
|
|
Ah, there we go. So, how 'bout this line break business? |
|
Back to top |
|
|
john Site Admin
Joined: 16 Mar 2004 Posts: 3434
|
Posted: Wed Jul 19, 2006 1:22 am Post subject: |
|
|
First thing to mention is that the gettext function converts a system generated message to another language when necessary (we have interfaces in English, Spanish, and French at this time). So when you see something like this:
Code: |
<%= gettext("Comment subject:") %> |
it will try to look into our dictionary of translatable phrases and if the user has chosen an non-English language in their preferences, will translate the phrase Comment subject to Spanish or French for those users who have set their Language preferences to those languages by looking for the equivalent phrase in our dictionary.
So there is no need to do something like this:
Code: | <%= gettext("{{title}}") %> |
which would essentially mean "Translate the content of the Title of this post to the user's language of choice": we don't have your post title in our dictionary so there's no way to translate it.
So instead of this:
Code: | <%= gettext("{{title}}") %>
<%= gettext("--------------") %>
<%= gettext("{{body}}") %>
<%= gettext("-{{author}}") %>
{{if num_attachments}}<%= gettext("{{num_attachments}} attachment(s) accessible on the website") %>{{else}}{{/if}}
<%= gettext("Full article link:") %> {{permalink_url}} |
You could use just this:
Code: | {{title}}
--------------
{{body}}
-{{author}}
{{if num_attachments}}<%= gettext("{{num_attachments}} attachment(s) accessible on the website") %>{{else}}{{/if}}
<%= gettext("Full article link:") %> {{permalink_url}} |
So going back to your original question:
Quote: | I'd like to use plain text rather than HTML in the notification emails that my blog sends out. |
We send all article notification emails as Content-Type text/html, which makes sense as any content you post to your blog is expected to be html. It is not possible to send notifications as plain text. So if you want line breaks you would need to enter them as HTML line breaks:
Code: | {{title}}<br>
<br>
--------------<br>
<br>
{{body}}<br>
<br>
-{{author}}<br>
<br>
<br>
{{if num_attachments}}<%= gettext("{{num_attachments}} attachment(s) accessible on the website") %>{{else}}{{/if}} <br>
<br>
<br>
<%= gettext("Full article link:") %> {{permalink_url}} |
Hope this helps. |
|
Back to top |
|
|
williamholmgren
Joined: 13 Jun 2006 Posts: 6
|
Posted: Wed Jul 19, 2006 11:03 am Post subject: |
|
|
I see. I was trying to just copy the style of the default comment notification email, which was obviously full of gettext. I thought 'gettext' was something like 'print' in pick-your-programming-language. Thanks for clearing that up!
Quote: |
We send all article notification emails as Content-Type text/html, which makes sense as any content you post to your blog is expected to be html. It is not possible to send notifications as plain text.
|
True, any content actually on the blog will be in html, but it was not originally written that way. Somewhere along the line you guys have some perl/php/ruby script that takes a newline character like /n and converts it to <br>. So, it seems like it would not be too difficult to send out the email before it hits that parsing, especially if the post doesn't have rich text features. Or, you could almost as easily parse back out of html and into plain text.
There's still a lot of people that don't use html enabled email clients. For example, my school's webmail service doesn't play well with html and there's 40,000 of us. And it's always nice to give the option for people that might be reading their email on cell phones, etc.
Still, I can't blame blogharbor for not having everything we're after. A physics lab trying to communicate more effectively is probably not what blogharbor had in mind when it was trying to imagine its user base. |
|
Back to top |
|
|
john Site Admin
Joined: 16 Mar 2004 Posts: 3434
|
Posted: Wed Jul 19, 2006 12:59 pm Post subject: |
|
|
Somewhere along the line you guys have some perl/php/ruby script that takes a newline character like /n and converts it to <br>.
Just for your reference the system is written in Ruby, and that conversion only happens if you 1) are not using the Rich Text Editor to compose your posts and 2) if you check the 'Preserve line and paragraphs breaks' checkbox when creating your article.
A physics lab trying to communicate more effectively is probably not what blogharbor had in mind when it was trying to imagine its user base.
Actually, we did imagine groups and organizations using our service to communicate more effectively, which is why we built the system with a strong users and groups security model from the beginning. We see you are taking advantage of that security model.
Our email notifications system exists to supplement the primary means of syndicating your content which is RSS. Your site supports the use of secure RSS to syndicate content, which may be a better way overall to get your content distributed.
If you are looking for more options with respect to email subscriptions, check out this new service Zookoda. I have been testing this service, and it offers a very sophisticated means of handling email subscriptions. It can allow you to create email lists from RSS feeds, and it can read one of our secure RSS feeds if you supply it with a valid username and password. Not sure if it will be exactly what you are looking for (I don't think it will escape the HTML in posts), but it may be worth a look. |
|
Back to top |
|
|
williamholmgren
Joined: 13 Jun 2006 Posts: 6
|
Posted: Wed Jul 19, 2006 1:07 pm Post subject: |
|
|
Thanks for the suggestions. I'll check them out. By the way, the strong users model and security features was a big factor in choosing blogharbor. |
|
Back to top |
|
|
Search all BlogHarbor support resources.
|
View previous topic :: View next topic |
|