summaryrefslogtreecommitdiff
path: root/lib/feed2imap/itemtomail.rb
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2009-12-26 01:51:37 +0100
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2009-12-26 01:51:37 +0100
commitdb52aeb97fcc73e3b9a3a2a6e2e9eb63fd4cb0f8 (patch)
tree7839546f11f95a37bd3016d1e2ad38c8f3d6e727 /lib/feed2imap/itemtomail.rb
parentec808b0f4bfd213b7b81996d8c46c1d98bbafa7c (diff)
downloadfeed2imap-db52aeb97fcc73e3b9a3a2a6e2e9eb63fd4cb0f8.tar.gz
feed2imap-db52aeb97fcc73e3b9a3a2a6e2e9eb63fd4cb0f8.tar.bz2
feed2imap-db52aeb97fcc73e3b9a3a2a6e2e9eb63fd4cb0f8.zip
Avoid using "acme.com"
Patch from Guido Berhoerster <guido@berhoerster.name>: Hello, here is a small patch that avoids using the valid(!) domain "acme.com" for generating message ids and email addresses. It adds a new global configuration option "default-email" which will be used in case a feed does provide one, currently feed2imap resorts to "feed2imap@acme.com". If this configuration option is not given it will basically default to <logname>@<hostname> as returned by Etc.getlogin and Socket.gethostname. Yours,
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/itemtomail.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb
index d12d3c5..6c70cbd 100644
--- a/lib/feed2imap/itemtomail.rb
+++ b/lib/feed2imap/itemtomail.rb
@@ -47,18 +47,18 @@ class String
end
end
-def item_to_mail(item, id, updated, from = 'Feed2Imap', inline_images = false, wrapto = false)
+def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images = false, wrapto = false)
message = RMail::Message::new
if item.creator and item.creator != ''
if item.creator.include?('@')
message.header['From'] = item.creator.chomp
else
- message.header['From'] = "=?utf-8?b?#{Base64::encode64(item.creator.chomp).gsub("\n",'')}?= <feed2imap@acme.com>"
+ message.header['From'] = "=?utf-8?b?#{Base64::encode64(item.creator.chomp).gsub("\n",'')}?= <#{config.default_email}>"
end
else
- message.header['From'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <feed2imap@acme.com>"
+ message.header['From'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <#{config.default_email}>"
end
- message.header['To'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <feed2imap@acme.com>"
+ message.header['To'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <#{config.default_email}>"
if item.date.nil?
message.header['Date'] = Time::new.rfc2822
@@ -94,7 +94,7 @@ def item_to_mail(item, id, updated, from = 'Feed2Imap', inline_images = false, w
# $2 contains url, $3 the image name, $4 the image extension
begin
image = Base64.encode64(HTTPFetcher::fetch($2, Time.at(0)).chomp) + "\n"
- cid = "#{Digest::MD5.hexdigest($2)}@feed2imap.acme.com"
+ cid = "#{Digest::MD5.hexdigest($2)}@#{config.hostname}"
if not cids.include?(cid)
cids << cid
imgpart = RMail::Message.new