E-mail Full Article Content to Subscribers #44

Closed
mudge opened this Issue May 17, 2012 · 12 comments

Comments

Projects
None yet
3 participants
@mudge

mudge commented May 17, 2012

I've begun work on a branch to allow administrators to e-mail the full body of an article to subscribers as and when they are first published (following the example of James Edward Gray II's "Rubies in the Rough").

In order to retain the rich formatting shown on the Practicing Ruby web site, I'm experimenting with a multipart email showing HTML content for those who support it but gracefully degrading to plain text for those without (see CampaignMonitor's "Guide to CSS support in Email re support). It would also make sense to allow users to choose their delivery format in case they wish to receive only the plain text version.

However, to be more representative of actual Practicing Ruby content, could I please have the original Markdown source of a representative article, perhaps one that is already free to the public such as "Unobtrusive Ruby" in Practice" or perhaps one with images such as "Using games to practice domain modeling"?

At the moment, I believe @sandal manually sends announcement emails (please correct me if I'm wrong) so perhaps it would be good to allow for that freeform announcement message to be specified in the mailshot as well (though this could wait).

@practicingruby

This comment has been minimized.

Show comment
Hide comment
@practicingruby

practicingruby May 17, 2012

Member

Here you go: https://raw.github.com/gist/2719212/d6488b4a38dcc79cdf894f00e84c64fb8cdb7763/unobtrusive.md

To prove the concept, I wouldn't bother working through the details of what the final feature would look like. Instead, I would try to come up with a template that would represent the above article very nicely in HTML emails. We will need to verify that it's possible to have a good reading experience in email before we can even consider this feature.

Member

practicingruby commented May 17, 2012

Here you go: https://raw.github.com/gist/2719212/d6488b4a38dcc79cdf894f00e84c64fb8cdb7763/unobtrusive.md

To prove the concept, I wouldn't bother working through the details of what the final feature would look like. Instead, I would try to come up with a template that would represent the above article very nicely in HTML emails. We will need to verify that it's possible to have a good reading experience in email before we can even consider this feature.

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge May 27, 2012

@sandal I just sent a test email to your Gmail account with a prototype for the given article. The message itself is multipart with the raw Markdown source as the plain text component (as Markdown was originally optimised for such purposes) and a styled HTML part for mail clients that support it.

Note the HTML part uses inline styles on every element for its design for maximal support in clients such as Gmail.

This was done by modifying the output with Nokogiri much like you already do in https://github.com/elm-city-craftworks/practicing-ruby-web/blob/master/config/initializers/markdown.rb#L15-23

mudge commented May 27, 2012

@sandal I just sent a test email to your Gmail account with a prototype for the given article. The message itself is multipart with the raw Markdown source as the plain text component (as Markdown was originally optimised for such purposes) and a styled HTML part for mail clients that support it.

Note the HTML part uses inline styles on every element for its design for maximal support in clients such as Gmail.

This was done by modifying the output with Nokogiri much like you already do in https://github.com/elm-city-craftworks/practicing-ruby-web/blob/master/config/initializers/markdown.rb#L15-23

@practicingruby

This comment has been minimized.

Show comment
Hide comment
@practicingruby

practicingruby May 27, 2012

Member

@mudge: wow, that looks great! Please submit a pull request and I'll test on a larger corpus of articles.

Member

practicingruby commented May 27, 2012

@mudge: wow, that looks great! Please submit a pull request and I'll test on a larger corpus of articles.

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge May 27, 2012

@sandal I just sent you an updated version with some fixes for the inline code blocks and updated the syntax highlighting to match the styles used on the site.

For others that want to review this, you can see the email source at https://gist.github.com/d7d67d00b2e34c899ff3

I'll hook this up with the app and then submit a pull request as soon as possible.

mudge commented May 27, 2012

@sandal I just sent you an updated version with some fixes for the inline code blocks and updated the syntax highlighting to match the styles used on the site.

For others that want to review this, you can see the email source at https://gist.github.com/d7d67d00b2e34c899ff3

I'll hook this up with the app and then submit a pull request as soon as possible.

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge May 28, 2012

@sandal I've uploaded an EmailHelper that provides a single md_for_email function you can use the test a wider corpus at https://gist.github.com/52441298f6f1f0ed4b43

If you're happy with it then we can hash out how best to incorporate it into the app along with some sort of ArticleMailer.

mudge commented May 28, 2012

@sandal I've uploaded an EmailHelper that provides a single md_for_email function you can use the test a wider corpus at https://gist.github.com/52441298f6f1f0ed4b43

If you're happy with it then we can hash out how best to incorporate it into the app along with some sort of ArticleMailer.

@practicingruby

This comment has been minimized.

Show comment
Hide comment
@practicingruby

practicingruby May 28, 2012

Member

@mudge: Thanks!

I need to sort out some issues with mailing, right now we're using Gmail but plan to move to SendGrid. We've got a lot on our plate right now, but I will definitely test this out in the next couple weeks and see how we might be able to integrate it. Please ping me again if I somehow forget.

Member

practicingruby commented May 28, 2012

@mudge: Thanks!

I need to sort out some issues with mailing, right now we're using Gmail but plan to move to SendGrid. We've got a lot on our plate right now, but I will definitely test this out in the next couple weeks and see how we might be able to integrate it. Please ping me again if I somehow forget.

@practicingruby

This comment has been minimized.

Show comment
Hide comment
@practicingruby

practicingruby May 28, 2012

Member

@mudge: Just so you know, we will probably try to integrate this feature first as a way to send full text comments (that's a feature we have on our short list of things to do anyway), and then from there processing the whole articles should be easy.

Member

practicingruby commented May 28, 2012

@mudge: Just so you know, we will probably try to integrate this feature first as a way to send full text comments (that's a feature we have on our short list of things to do anyway), and then from there processing the whole articles should be easy.

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge May 28, 2012

Sounds good; let me know if there is anything I can do to help (re-organising the helper into some other form, etc.)

mudge commented May 28, 2012

Sounds good; let me know if there is anything I can do to help (re-organising the helper into some other form, etc.)

@jordanbyron

This comment has been minimized.

Show comment
Hide comment
@jordanbyron

jordanbyron May 28, 2012

Member

@mudge did you take a look at the inline-style gem? It seems like a good fit for this feature. From reading the documentation it should pull in the styles from our style sheets and inline them automatically. That's much better than having to maintain the styles in two places (in both sass and CSS in the helper)

Member

jordanbyron commented May 28, 2012

@mudge did you take a look at the inline-style gem? It seems like a good fit for this feature. From reading the documentation it should pull in the styles from our style sheets and inline them automatically. That's much better than having to maintain the styles in two places (in both sass and CSS in the helper)

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge May 28, 2012

@jordanbyron Ah no, that'd be great for reducing the duplication (particularly for the syntax highlighting). In my code for the original mock-up, I ended up parsing pygments.css to dynamically add in-line styles but thought it best to make it more explicit in the helper.

The only issue is whether we can rely on the browser HTML styling being compatible with email styling (e.g. font-family should be used over font for compatibility, etc.)

mudge commented May 28, 2012

@jordanbyron Ah no, that'd be great for reducing the duplication (particularly for the syntax highlighting). In my code for the original mock-up, I ended up parsing pygments.css to dynamically add in-line styles but thought it best to make it more explicit in the helper.

The only issue is whether we can rely on the browser HTML styling being compatible with email styling (e.g. font-family should be used over font for compatibility, etc.)

@practicingruby

This comment has been minimized.

Show comment
Hide comment
@practicingruby

practicingruby Nov 21, 2012

Member

@mudge I'm really sorry that we never properly investigated merging this patch. I'm sure at this point its pretty far out of sync with our app. That's the cost of having very limited development resources on our end :-/

That said, this was a great feature idea, and if and when I get around to building this, I'll come back to this patch and use your work as a guide. Thanks for contributing!

Member

practicingruby commented Nov 21, 2012

@mudge I'm really sorry that we never properly investigated merging this patch. I'm sure at this point its pretty far out of sync with our app. That's the cost of having very limited development resources on our end :-/

That said, this was a great feature idea, and if and when I get around to building this, I'll come back to this patch and use your work as a guide. Thanks for contributing!

@mudge

This comment has been minimized.

Show comment
Hide comment
@mudge

mudge Nov 21, 2012

No problem at all, I hope it can still be of use as I would love to receive full articles by email.

mudge commented Nov 21, 2012

No problem at all, I hope it can still be of use as I would love to receive full articles by email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment