[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Memory&Time overload in sending smtp gmail with big attach

Rk Ch

11/29/2007 9:14:00 AM

Recently, I block a gmail sending program(named 'testsmtp.rb'), with
ruby1.9 Net::SMTP class(net/smtp.rb renamed to 'smtpssl.rb') and a
custom MAIL BODY builder class (named 'smtp_mail_builder.rb').

It works well for sending text email with tiny attachments. But, When
trying to send a 3M .zip attachment in mail, the prg almost used 200M
memory, and 20 minutes without end.

I guess maybe SSL or SMTP need more appropriate setting for sending big
attachment mail. It had been out of my ablity.

Anybody can give an advice?

Thanks a lot!

== testsmtp.rb ==================================
require "smtp_mail_builder"
require "smtpssl"
require "openssl"

fromName='name from'
fromEMail='mail from'
subject='Subject'
content='Content text'
files=['a.zip']
to='***@***.com'
# build the message
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
message = Net::SMTP::Message.new(fromName, fromEMail, subject, content)
files.each do |file|
message.attachBinaryFile(file)
end


mailServer= "smtp.gmail.com"
mailUsername= "gmail user name"
mailPassword= "password for gmail user name"
# send the email
message_array = message.format(to)
Net::SMTP.start(mailServer, 587, "localhost.localdomain", mailUsername,
mailPassword, :login) do |smtp|
smtp.sendmail(message_array, message.fromEMail, to)
end

===End============================================

Attachments:
http://www.ruby-...attachment/1055/gmail...

--
Posted via http://www.ruby-....