Permalink
Browse files

Support aliases

  • Loading branch information...
1 parent f1a8e93 commit fa0cd61f670eed986c160b622c0a10a35ad06e59 @orgads orgads committed Dec 8, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/simpleMailer.rb
View
@@ -52,6 +52,10 @@ def attach_files(files)
self
end
+ def addr(field)
+ return field.gsub(/[^<]*<([^>]*)>/, '\1')
+ end
+
def generate_file_part(file)
b64file=String.new
filename=File.basename(file)
@@ -96,7 +100,8 @@ def send()
Net::SMTP.start(@host,@port) do |smtp|
begin
generate_body
- smtp.send_message(@body,@from,@to)
+ to = @to.map { |t| addr(t) }.join(', ')
+ smtp.send_message(@body,addr(@from),to)
return true
rescue => e
e

0 comments on commit fa0cd61

Please sign in to comment.