Mail body is not generated.

60 views
Skip to first unread message

Peter-Hinrich Krogmann

unread,
Jul 11, 2014, 9:38:30 AM7/11/14
to mail...@googlegroups.com
In the example program 'mail1.rb' no mail body is generated.

If the line 3 with line 4 interchanged as in example 'mail2.rb' then a mail body is generated.


================================mail1.rb example================================

----------[Start of source code mail1.rb]----------

  require 'mail'
  mail_handler = Mail.new()
  mail_handler.body = 'mail body text'
  mail_handler.attachments['test.bin'] = { :content   => 'test.bin - text' }
  print mail_handler.to_s

----------[End of source code mail1.rb]----------

----------[Start of execution mail1.rb]----------

  kro44@peter4 14:04:58 /Volumes/common/developm/ruby/ruby/sendmail/ruby $ ruby mail1.rb
  Date: Fri, 11 Jul 2014 14:05:05 +0200
  Message-ID: <53bfd2f1165d5_47...@peter4.fritz.box.mail>
  Mime-Version: 1.0
  Content-Type: multipart/mixed;
   boundary="--==_mimepart_53bfd2f116196_47d3fc6ae05e47013541";
   charset=UTF-8
  Content-Transfer-Encoding: 7bit


  ----==_mimepart_53bfd2f116196_47d3fc6ae05e47013541
  Content-Type: application/x-mac;
   charset=UTF-8;
   filename=test.bin
  Content-Transfer-Encoding: base64
  Content-Disposition: attachment;
   filename=test.bin
  Content-ID: <53bfd2f117134_47d...@peter4.fritz.box.mail>

  dGVzdC5iaW4gLSB0ZXh0

  ----==_mimepart_53bfd2f116196_47d3fc6ae05e47013541--

----------[End of execution mail1.rb]----------


================================mail2.rb example================================

----------[Start of source code mail2.rb]----------

  require 'mail'
  mail_handler = Mail.new()
  mail_handler.attachments['test.bin'] = { :content   => 'test.bin - text' }
  mail_handler.body = 'mail body text'
  print mail_handler.to_s

----------[End of source code mail2.rb]----------

----------[Start of execution mail2.rb]----------

  kro44@peter4 14:04:49 /Volumes/common/developm/ruby/ruby/sendmail/ruby $ ruby mail2.rb
  Date: Fri, 11 Jul 2014 14:04:55 +0200
  Message-ID: <53bfd2e77bc43_47b...@peter4.fritz.box.mail>
  Mime-Version: 1.0
  Content-Type: multipart/mixed;
   boundary="--==_mimepart_53bfd2e77b82d_47b3fe17485e4648931e";
   charset=UTF-8
  Content-Transfer-Encoding: 7bit


  ----==_mimepart_53bfd2e77b82d_47b3fe17485e4648931e
  Content-Type: text/plain;
   charset=UTF-8
  Content-Transfer-Encoding: 7bit

  mail body text
  ----==_mimepart_53bfd2e77b82d_47b3fe17485e4648931e
  Content-Type: application/x-mac;
   charset=UTF-8;
   filename=test.bin
  Content-Transfer-Encoding: base64
  Content-Disposition: attachment;
   filename=test.bin
  Content-ID: <53bfd2e77c988_47b...@peter4.fritz.box.mail>

  dGVzdC5iaW4gLSB0ZXh0

  ----==_mimepart_53bfd2e77b82d_47b3fe17485e4648931e--

----------[End of execution mail2.rb]----------

Reply all
Reply to author
Forward
0 new messages