I'm using the Pony gem to send emails. Assuming that I have both options open to me, is there a memory advantage to using :smtp or :sendmail?
Option 1: smtp
Here, Ruby connects directly to the SMTP server.
Pony.mail(
:to => 'you@example.com',
:via => :smtp,
:via_options => {
:address => 'smtp.yourserver.com',
:port => '25',
:user_name => 'user',
:password => 'password',
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
})
Option 2: sendmail
Here, the local sendmail
binary is spawned.
Pony.mail(
:to => 'you@example.com',
:via => :sendmail,
:via_options => {
:location => '/path/to/sendmail',
:arguments => '-t'
})
In particular, I'm concerned about loading the entire contents of a file into memory before attaching it - but this seems to be necessary in both modes:
Pony.mail([...], :attachments => {"foo.zip" => File.read("path/to/foo.zip")})
This is similar to Sendmail vs SMTP, but those answers don't cover my question.