class Mail::SMTPConnection
mail.deliver!
end
body ‘testing sendmail’
subject ‘testing sendmail’
from ‘ada@test.lindsaar.net’
to ‘mikel@test.lindsaar.net’
mail = Mail.new do
Or by calling deliver on a Mail message
end
body ‘testing sendmail’
subject ‘testing sendmail’
from ‘ada@test.lindsaar.net’
to ‘mikel@test.lindsaar.net’
Mail.deliver do
end
delivery_method :smtp_connection, { :connection => smtp_conn }
Mail.defaults do
smtp_conn = Net::SMTP.start(settings, settings)
Once you have the settings right, sending the email is done by:
=== Delivering the email
To send mail open a connection with Net::Smtp using any options you like
=== Sending via SMTP server on Localhost
our local mail server by reducing the number of connections at any one time.
passing a created Net::SMTP object. This way we can get better performance to
Mail allows you to send emails using an open SMTP connection. This is done by
== Sending Email with SMTP
def deliver!(mail)
Send the message via SMTP.
def deliver!(mail) envelope = Mail::SmtpEnvelope.new(mail) response = smtp.sendmail(envelope.message, envelope.from, envelope.to) settings[:return_response] ? response : self end
def initialize(values)
def initialize(values) raise ArgumentError.new('A Net::SMTP object is required for this delivery method') if values[:connection].nil? self.smtp = values[:connection] self.settings = values end