```ruby

# au-kddi handsets render html mail properly only when 
# all mime parts are in a flat multipart/alternate structure
class Galakei::Email::AuMailInterceptor
  def self.delivering_email(message)

    if message.to.first =~ /^.+@ezweb\.ne\.jp$/
      if message.content_type =~ /^multipart\/related/
        params = message.content_type_parameters || {}
        message.content_type = ["multipart", "alternative", params]
        message.parts.each do |part|
          if part.content_type =~ /^multipart\/alternative/
            message.add_part(part.text_part)
            message.add_part(part.html_part)
            message.parts.delete(part)
          end
        end
      end
    end

  end
end

```

Add all parts within multipart alternative
user
```ruby

# au-kddi handsets render html mail properly only when 
# all mime parts are in a flat multipart/alternate structure
class Galakei::Email::AuMailInterceptor
  def self.delivering_email(message)

    if message.to.first =~ /^.+@ezweb\.ne\.jp$/
      if message.content_type =~ /^multipart\/related/
        params = message.content_type_parameters || {}
        message.content_type = ["multipart", "alternative", params]
        message.parts.each do |part|
          if part.content_type =~ /^multipart\/alternative/
            part.parts.each{ |p| message.add_part(p) }
            message.parts.delete(part)
          end
        end
      end
    end

  end
end

```
assistant