summaryrefslogtreecommitdiff
path: root/lib/feed2imap/itemtomail.rb
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2009-05-06 10:56:07 +0200
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2009-05-06 10:56:07 +0200
commit31361b976200db24e704380360882a04244256a6 (patch)
treec37567dd51ba3b2245665c044fcd289a27ddc3f2 /lib/feed2imap/itemtomail.rb
parent8df5558cd8c98107aea0446f212a1883bc120a6e (diff)
downloadfeed2imap-31361b976200db24e704380360882a04244256a6.tar.gz
feed2imap-31361b976200db24e704380360882a04244256a6.tar.bz2
feed2imap-31361b976200db24e704380360882a04244256a6.zip
Fix encoding of From: and To: headers
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/itemtomail.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb
index 8744021..ec3bbfb 100644
--- a/lib/feed2imap/itemtomail.rb
+++ b/lib/feed2imap/itemtomail.rb
@@ -51,18 +51,14 @@ def item_to_mail(item, index, updated, from = 'Feed2Imap', inline_images = false
message = RMail::Message::new
if item.creator and item.creator != ''
if item.creator.include?('@')
- hdr_from = item.creator.chomp
+ message.header['From'] = item.creator.chomp
else
- hdr_from = "#{item.creator.chomp} <feed2imap@acme.com>"
+ message.header['From'] = "=?utf-8?b?#{Base64::encode64(item.creator.chomp).gsub("\n",'')}?= <feed2imap@acme.com>"
end
else
- hdr_from = "#{from} <feed2imap@acme.com>"
+ message.header['From'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <feed2imap@acme.com>"
end
-
- hdr_to = "#{from} <feed2imap@acme.com>"
-
- message.header['From'] = "=?utf-8?b?#{Base64::encode64(hdr_from)}?="
- message.header['To'] = "=?utf-8?b?#{Base64::encode64(hdr_to)}?="
+ message.header['To'] = "=?utf-8?b?#{Base64::encode64(from).gsub("\n",'')}?= <feed2imap@acme.com>"
if item.date.nil?
message.header['Date'] = Time::new.rfc2822