Hi Everyone,
I have run across an interesting problem. I am sending email with attachments through the NET::SMTP class in ruby through Apple's me.com SMTP servers and I am running into some funny issues.
I am trying to send a series of jpg files through the SMTP server. I am encoding them in ruby and when I send to another me.com email all five jpg images show up at the other end in perfect condition. When I send to my gmail address the files truncate at 90k (they are normally around 500k). When I open the two emails in textmate I see the encoding on the text portion of the email is 8bit on the email sent to the .me address and 7bit in the email sent to the gmail server. I'm not sure if this is my problem or not.
Here is a brief of the code I am using:
file1Content = File.read(directory +'/Photo_1.jpg')
file1 = [file1Content].pack("m")
marker = "AUNIQUEMARKER"
body =<<EOF
#{emailbody}
EOF
# Define the main headers.
part1 =<<EOF
From: #{from}
To: #{donor}
Subject: #{subject}
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=#{marker}
--#{marker}
EOF
# Define the message action
part2 =<<EOF
Content-Transfer-Encoding:8bit
Content-Type: text/plain
#{body}
--#{marker}
EOF
# Define the attachment section
part3 =<<EOF
Content-Type: image/jpeg; name=\"Photo_1.jpg\"
Content-Transfer-Encoding:base64
Content-Disposition: attachment; filename="Photo_1.jpg"
#{file1}
--#{marker}
EOF
(etc to 5 files where I end the marker with --#{marker}--
I would really appreciate any help you could give. I'm completely stumped. A couple of other notes. I am using MacRuby and not all Gems work on it, especially for embeded MacRuby. I have had some success with small libraries but I haven't had any luck with ActionMailer.