class HIO
Public Class Methods
gmailOptions(username, password)
click to toggle source
# File lib/hmisc/hio.rb, line 62 def self.gmailOptions(username, password) return options = { :address => "smtp.gmail.com", :port => 587, :user_name => username, :password => password, :authentication => 'plain', :enable_starttls_auto => true } end
gmxOptions(username, password)
click to toggle source
# File lib/hmisc/hio.rb, line 76 def self.gmxOptions(username, password) return options = { :address => "mail.gmx.com", :port => 587, :user_name => username, :password => password, :authentication => 'plain', :enable_starttls_auto => true } end
htmlEcholn(str)
click to toggle source
# File lib/hmisc/hio.rb, line 25 def self.htmlEcholn(str) return "" if (str == "") #return str.to_s return str.to_s + "\n" end
htmlEcholnCloseBlock(str)
click to toggle source
# File lib/hmisc/hio.rb, line 39 def self.htmlEcholnCloseBlock(str) @@indentSpace -= 1 return self.htmlEcholn(str); end
htmlEcholnOpenBlock(str)
click to toggle source
# File lib/hmisc/hio.rb, line 31 def self.htmlEcholnOpenBlock(str) result = self.htmlEcholn(str) @@indentSpace += 1 return result end
isQuoted(str)
click to toggle source
# File lib/hmisc/hio.rb, line 50 def self.isQuoted(str) return (str[0] == "'" && str[-1] == "'") end
options(emailFrom, emailPassword)
click to toggle source
# File lib/hmisc/hio.rb, line 89 def self.options(emailFrom, emailPassword) provider = emailFrom[emailFrom.index('@') + 1, emailFrom.size - 1] return self.gmxOptions(emailFrom, emailPassword) if(provider == "gmx.com") return self.gmailOptions(emailFrom, emailPassword) if(provider == "gmail.com") end
quote(str)
click to toggle source
# File lib/hmisc/hio.rb, line 46 def self.quote(str) return "'#{str}'"; end
sendEmail(emailFrom, emailTo, emailSubject, emailBody, emailPassword = "quickorder", emailFromName = "")
click to toggle source
# File lib/hmisc/hio.rb, line 98 def self.sendEmail(emailFrom, emailTo, emailSubject, emailBody, emailPassword = "quickorder", emailFromName = "") Mail.defaults do delivery_method :smtp, self.options(emailFrom, emailPassword) end Mail.deliver do to emailTo from emailFrom subject emailSubject body emailBody end =begin message = <<MESSAGE_END From: Private Person <herbert.bonaffini@gmx.com> To: A Test User <herbert.bonaffini@gmail.com> Subject: SMTP e-mail test This is a test e-mail message. MESSAGE_END Net::SMTP.start('smtp.gmx.com', 465, 'localhost', 'herbert.bonaffini@gmx.com', 'quickorder', :plain) do |smtp| smtp.send_message message, 'herbert.bonaffini@gmx.com', 'herbert.bonaffini@gmail.com' end provider = substr($emailFrom, strpos($emailFrom, '@') + 1); if(provider == "gmx.com") phpMailer = HIO::gmxPHPmailer(); else phpMailer = HIO::gmailPHPmailer(); phpMailer->Username = emailFrom; phpMailer->Password = password; =end end
unQuote(str)
click to toggle source
# File lib/hmisc/hio.rb, line 56 def self.unQuote(str) return isQuoted(str) ? str[1..-2] : str end