begin
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start(‘smtp.gmail.com’, 587, ‘gmail.com’, from, password,
:login) do |smtp|
smtp.send_message(mailtext, from, mail_to)
end
rescue Exception => e
print "Mailing exception occured: " + e
end
end
After this, how can I send multiple attachment, suppose files to attach
are in array ‘a_array’?
OR EASIEAST WAY TO SEND MULTIPLE ATTACHMENT TO MULTIPLE EMAILS?
If you obtain cacert.pem from a trusted location (e.g. [2]), you can configure
Net::SMTP accordingly:
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_PEER,
File.join(File.dirname(FILE), “…”, “cacert.pem”))
Sorry, the path to cacert.pem in the Ruby was contrived; can you tell
I’m copying from my own code?
is it compatible with ruby 1.7.8?
Do you mean 1.7.8 or 1.8.7? It’s tested as working on 1.8.7 [1].
Gem::Specification (NilClass instead).
[/usr/lib/ruby/gems/1.8/specifications/mime-types-1.19.gemspec] isn’t a
Gem::Specification (NilClass instead).
ERROR: While executing gem … (ArgumentError)
marshal data too short
I’m not familiar with this; perhaps someone else is familiar.
You appear to be missing a marker somewhere. Why not use the mail gem[1]
and let it handle this for you?
is it compatible with ruby 1.7.8?
and if I try to install mail gem it gives error:
sudo gem install mail
[/usr/lib/ruby/gems/1.8/specifications/treetop-1.4.11.gemspec] isn’t a
Gem::Specification (NilClass instead).
[/usr/lib/ruby/gems/1.8/specifications/i18n-0.6.1.gemspec] isn’t a
Gem::Specification (NilClass instead).
[/usr/lib/ruby/gems/1.8/specifications/polyglot-0.3.3.gemspec] isn’t a
Gem::Specification (NilClass instead).
[/usr/lib/ruby/gems/1.8/specifications/mail-2.4.4.gemspec] isn’t a
Gem::Specification (NilClass instead).
[/usr/lib/ruby/gems/1.8/specifications/mime-types-1.19.gemspec] isn’t a
Gem::Specification (NilClass instead).
ERROR: While executing gem … (ArgumentError)
marshal data too short