Class: Mail::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/notes_mailer.rb

Overview

Sending Email with NotesMailer

NotesMailer allows you to send emails using IBM Lotus Notes. This is done by wrapping the Lotus Notes-win32ole-api. The usage is very similar to the SMTP devlivery method in the mail gem.

require ‘rubygems’ require ‘notes_mailer’

Mail.defaults do

delivery_method Mail::NotesMailer, { :address              => "",
                          :user_name            => '<username>',
                          :password             => '<password>',
                          :db => '<database>'}

end

Delivering the email (from smtp.rb)

Once you have the settings right, sending the email is done by:

Mail.deliver do
  to '[email protected]'
  from '[email protected]'
  subject 'testing sendmail'
  body 'testing sendmail'
end

Or by calling deliver on a Mail message

mail = Mail.new do
  to '[email protected]'
  from '[email protected]'
  subject 'testing sendmail'
  body 'testing sendmail'
end

mail.deliver!

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Message

Returns a new instance of Message.



46
47
48
49
# File 'lib/notes_mailer.rb', line 46

def initialize(*args, &block)
  @files_to_attach = []
  old_initialize(*args, &block)
end

Instance Attribute Details

#files_to_attachObject (readonly)

Returns the value of attribute files_to_attach.



45
46
47
# File 'lib/notes_mailer.rb', line 45

def files_to_attach
  @files_to_attach
end

Instance Method Details

#add_file(filename) ⇒ Object



50
51
52
53
54
# File 'lib/notes_mailer.rb', line 50

def add_file(filename)
  raise "Parameter must be a string" unless filename.is_a?String
  raise "File '#{filename}' does not exists" unless File.exists?(filename)
  @files_to_attach << filename
end

#old_initializeObject



44
# File 'lib/notes_mailer.rb', line 44

alias old_initialize initialize