require ''digest/sha1''
require ''net/smtp''
tfile_name="/home/praveen/test.zip"
toEmail = Array.new
toEmail << "1NAME
\<praveen.kothapalli-bJ7nOjMovssqc173qxkwHw@public.gmane.org\>"
fromEmail = "cyberdevdrona-bJ7nOjMovssqc173qxkwHw@public.gmane.org"
fromEmailAlias = "CyberDevDrona"
marker = "AUNIQUEMARKER"
part1 =<<EOF
Subject: Expert review for kata in language.
MIME-Version: 1.0
attachment :content_type => "application/zip",
:body => File.read(tfile_name),
:filename => File.basename(tfile_name)
Content-Type:"application/zip"; boundary=#{marker}
--#{marker}
EOF
part2 =<<EOF
--#{marker}
EOF
part3 =<<EOF
Content-Type: zip/attachment; name=\"#{tfile_name}\"
Content-Disposition: attachment; filename="#{tfile_name}"
--#{marker}--
EOF
mailtext = part1 + part2 + part3
Net::SMTP.start(''localhost'') do |smtp|
smtp.send_message mailtext, fromEmail, toEmail
end
I used this code to send my zip file as attachment but iam getting empty
zip file in mail. Could you please suggest me how to send a zip file as
attachment in ruby.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.