Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3308424
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:31:13+00:00 2026-05-17T21:31:13+00:00

I have run across an interesting problem. I am sending email with attachments through

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:31:13+00:00Added an answer on May 17, 2026 at 9:31 pm

    I had a friend come in and we worked through it and here is the result.

    In the email encodings the line breaks are extremely important. Some mail servers appear to be more forgiving (apple’s) which is why I didn’t see the problem initially.

    Here is the working code:

    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-Type: text/plain
    Content-Transfer-Encoding:8bit
    
    #{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
    
    part4 =<<EOF
    Content-Type: image/jpeg; name=Photo_2.jpg
    Content-Transfer-Encoding:base64
    Content-Disposition: attachment; filename=Photo_2.jpg
    
    #{file2}
    --#{marker}
    EOF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run across an interesting PHP/SOAP error that has me stymied. After searching I
So I have an interesting problem that's been the fruit of lots of good
I have an interesting design problem and I was hoping you all could make
I'm currently writing a small test Android app, and have run across a small
I have a Linode (Ubuntu 9.10, but upgrading not a problem) where I run
I've run across this code in a number of places: DEFINE BUFFER Customer FOR
I'm running into a problem with excel interop. Basically, what I'm trying to do
This is only marginally a programming problem and more of a networking problem. I'm
I have followed a tutorial to create a simple blog writing application in PHP
Let's say I have an existing application written in Java which I wish to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.