Hi all, I am trying to use ruby to send an email with attachment.
I am always getting the picture attachment as corrupted.
I used the “net/smtp” and also used “pony” (same problem on both).
this is what i am using now:
require “pony”
Pony.mail({
:to => ‘[email protected]’,
:via => :smtp,
:subject => “Installium-AUT”,
:body => “Download files status:\n
Error-Chrome: File is not available on disk\n
Please check manually for any Chrome errors: Maliciousness file, Not
commonly download.\n
Plese see attached screenshot.”,
#:headers => {“Content-Type” => “multipart/mixed”,
“Content-Transfer-Encoding” => “base64”, “Content-Disposition” =>
“attachment” },
:attachments => {‘screenshotCH.jpeg’ =>
‘C:\Users\tomer\Downloads’},
:via_options => {
:address => ‘smtp.gmail.com’,
:port => ‘587’,
:enable_starttls_auto => true,
:user_name => ‘[email protected]’,
:password => ‘xxx’,
:authentication => :plain, # :plain, :login, :cram_md5, no
auth by default
:domain => “smtp.gmail.com” # the HELO domain
provided by the client to the server
}
})
I really appreciate help with this one, how can i send a picture (of any
kind) successfully in the mail.
THX