How do i create a image displaying a email with rails? - ruby-on-rails

In my webapp i want to display user emails. But i dont want spam boots to steal my user emails. So have do i automatic create a image displaying there email?
Best regards,
A rails beginner

Creating an image is one way to go, but remember that OCR is getting to be an extremely "cheap" operation and isn't a guarantee that a bot wouldn't analyze all the pictures on your site to see if they contain text that looks like email addresses. There's plenty of techniques to "hide" addresses in plain sight. Write them out in character entity format, intersperse empty tags, uses javascript to decode an encoded form of them and insert into the page after load, etc...

Related

How to scrape different URLs from database with Nokogiri with different requirements

I tried using Feedjira to assist with content analysis from newsfeeds, but it appears that RSS feeds now only link to content rather than including them with RSS as I found out in "Feedjira not adding content and author". I plan to use Feedjira to get the URL for the article, but then use Nokogiri to scrape the article and pick out the relevant parts.
The problem is that each media outlet will have a different format for their pages and I need to know the best way for Nokogiri to take the URL from the database (supplied by Feedjira) and depending on the associated feed title (also the database from Feedjira sync) scrape the page in a specific way and save it to a separate table in the database. Anyone got any suggestions?
I don't know your special use case but I'm also doing content analysis using news feeds.
Maybe you'll have a look on Readability which provides you a generic content scraper.
The problem you've encountered is that every feed generator does it a bit differently, just as with HTML generators. You can assume certain fields are going to be in place in an RDF, RSS or ATOM feed, however the author of the feed could use optional tags that you could find very useful, so you have to write code to look for them.
I wrote several feed aggregators in the past, including one that was handling well over 1000 feeds daily. By sniffing out the feed type, ATOM vs. RSS vs RDF, then I could make sensible checks for fields that were interesting given that format, and extract the data if it was available.
Pre-canned parsers get it wrong too often, either grabbing data you don't want and making a mess of the output, or skipping data you do want leaving gaps in the output, so be prepared to write code if you want it done correctly.
You'll probably want to take advantage of a backing database too, to keep track of what you looked at last and when you're supposed to look at it again; That's part of being a good network citizen. You'll also want to keep track whether a feed was down the last n times you looked so you can trim out dead sites.

Send email as PDF in ruby on rails in Typo3

I have an web-application in RoR which calculates some energy values and investment money. I use ajax to send the data from the web-browser to the server. It is something like this: Browser-server-Browser-Server-Browser
This web-application is already integrated in typo3 and I want to implement a PDF button to send the results per email (in other words, a photo of the page with the results).
I have heard an option would be to generate some links in RoR to be used in typo3 (when clicking on it, it would open exactly the web-application with the results already calculated). But as a newbie, I do not really know which would be the best approach.
Any recommendation?
A screenshot of the page can be done client-side:
http://html2canvas.hertzen.com/
You could even have another page with the same results that you use only for the rendering of the result page what you use for making a clean screen-shot (you might not want to have the footer, menu and other elements on that page, only the results)
Once you have your screenshot, you can upload it to your server where you can use it to create a PDF of that image and then send it with any mail API you prefer to use.
info about TYPO3's mail api can be found here:
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Mail/Index.html

How to add embedded resource into ASP.NET MVC2 View?

I creating emails using partial views and saving them in DB (later they will be sent). I need to embed image into email to display in gmail. How to do this in ASP.NET MVC 2 project? How to embed image into view to make it work and display image in gmail?
You can't. Well, not reliably anyways. At least not in the way you mean. There is such a thing as data-url's, that allow you to embed an image into the page, but you will find that this is not widely supported by email clients and thus is not a reliable way to include images.
In fact, creating emails with embedded content is something of a black art. There are so many gotchas with various email client support that you have to do a lot of research into what does and doesn't work.
However, in general, what you want to do is use an embedded MIME image attachment in the email multi-part mime format, which has nothing whatsoever to do with MVC. All you would do in MVC is create your email with the appropriate tag (ie. <img src="cid:logo_sml.jpg">) to extract the mime content from the email, note that you won't see anything in a browser, as it only works in an email client.
You might want to read articles like these:
https://www.campaignmonitor.com/blog/post/3927/embedded-images-in-html-email
http://emailmarketing.comm100.com/email-marketing-tutorial/embedding-images-in-email.aspx
How to embed images in email
sending mail along with embedded image using asp.net

Export form data on iPad into printable PDF

I have an issue with "exporting" to PDF on an iPad.
My goal is, to take all the user data, a user has passed into the app for a form. The form itself is only available as a printed form, but I have the PDF as well. The thing is, after all the data has been given by the user, the output PDF I want to create for printing has to look completely like the printed version.
I have no idea of any "best practices" around how to accomplish this efficiently.
So my questions are:
Do I have to draw the form completely by myself and measure out all form field components on the printed form to draw them maybe with quartz2d?
Can I kind of parse the PDF I got already and read out all information to write a kind of script to transform the PDF into usable code?
What are best practices for filling out a form given in a paper version only to recreate the look of the original as close as possible? the look would be absolutely essential for the users of the app.
I do not have to read out form fields from the pdf. The only goal would be:
User taps on a print button in the app
from the user data provided by the app form a pdf should be created looking as close as possible compared to the printed version.
Thanks for any help on this
Sebastian
if you are doing this for iOS5 they check Ray's article
http://www.raywenderlich.com/6581/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-1
http://www.raywenderlich.com/6818/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-2

BlackBerry - intercept text in HTML

I would like to be able to intercept a hyperlink from an email on BlackBerry.
e.g.
dummy site
I have been able to intercept and identify text in a plain text email using PatternRepository. However, it doesn't seem to work with HTML emails - is this even possible?
I would like to avoid the solution of scanning every incoming email myself, and parsing all the text, but this might be the only option.
Thanks
This is not possible (up to and including BlackBerry 6 afaik). It is not related to the hyperlink concept - it is not possible to use PatternRepository with any type of text within HTML text.
For performance reasons, the BlackBerry designers decided not to implement pattern matching within HTML fields (browser, or email). This is very unfortunate, but it must be dealt with.
In my app, I had the freedom to define the contents of the email. In my case, I ended up including the pattern into the subject of the email - the user can click on the subject to get to my app.
In most other situations, I think the best/only way forward is to intercept each mail as it arrives and parse it looking for the text. If I have to do that in the future, I'll try to update this post with some sample code.
There are various posts on the BlackBerry forums about this issue.
Richard

Resources