如何使用 Ruby on Rails 从电子邮件中提取所有 URls/链接? [英] How can I extract all URls/links from an email using Ruby on Rails?

查看:30
本文介绍了如何使用 Ruby on Rails 从电子邮件中提取所有 URls/链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个书签网站.我想从电子邮件中提取所有 URI/链接.我的网站正在使用 Ruby on Rails.

I am building a bookmarking site. I want to extract all URIs/links from an email. My site is in using Ruby on Rails.

如何提取收到的电子邮件内容的所有 URL?

How can I extract all the URLs of received email content?

推荐答案

Ruby 的内置 URI 模块已经做到了:

Ruby's built-in URI module does this already:

来自extract文档:

require "uri"

URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
# => ["http://foo.example.com/bla", "mailto:test@example.com"]

这篇关于如何使用 Ruby on Rails 从电子邮件中提取所有 URls/链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆