class Qwik::Sendmail
Public Class Methods
new(host, port, test=false)
click to toggle source
# File vendor/qwik/lib/qwik/util-sendmail.rb, line 19 def initialize(host, port, test=false) @host, @port = host, port @test = test end
send(host, port, from, to, subject, body, test)
click to toggle source
FIXME: This method is too ad hoc.
# File vendor/qwik/lib/qwik/util-sendmail.rb, line 30 def self.send(host, port, from, to, subject, body, test) efrom = QuickML::Mail.encode_field(from.to_s) eto = QuickML::Mail.encode_field(to.to_s) esubject = QuickML::Mail.encode_field(subject) body = body.set_sourcecode_charset.to_mail_charset message = "From: #{efrom} To: #{eto} Subject: #{esubject} Content-Type: text/plain; charset=\"ISO-2022-JP\" #{body} " if test $smtp_sendmail = [host, port, efrom, eto, message] return message # for debug end require 'net/smtp' Net::SMTP.start(host, port) {|smtp| smtp.send_mail(message, from, to) } return nil end
Public Instance Methods
send(mail)
click to toggle source
# File vendor/qwik/lib/qwik/util-sendmail.rb, line 24 def send(mail) Sendmail.send(@host, @port, mail[:from], mail[:to], mail[:subject], mail[:content], @test) end