# File lib/fastcst/distrib.rb, line 101
101:     def Distribution.send_changeset(md_file, to_addr, server, port)
102:         # load the meta-data so we can process the contents
103:         md_contents = File.read(md_file)
104:         md = YAML.load(md_contents)
105:         
106:         # get just the dir and file separator
107:         md_dir, md_file = File.dirname(md_file), File.basename(md_file)
108: 
109:         # setup the from if the user didn't specify it
110:         from = md['Created By']['E-Mail']
111:         
112:         message = RMail::Message.new
113:         
114:         UI.event :sending, "#{to_addr} -- #{from} -- #{md['ID']}"
115:         message.header['To'] = to_addr
116:         message.header['From'] = from
117:         message.header['Subject'] = "[FCST] #{md['Project']} #{md['Revision']} -- #{md['Purpose']}"
118:         message.header[X_FASTCST_ID] = md['ID']
119:         message.header[X_FASTCST_PROJECT_NAME] = md['Project']
120:         
121:         # add the meta-data contents as the first contents inline
122:         part = RMail::Message.new
123:         part.header['Content-Disposition'] = 'inline'
124:         part.header[X_FASTCST_MD_NAME] = md_file
125:         part.body = md_contents
126:         message.add_part(part)
127:         
128:         Dir.chdir md_dir do
129:             # load the request files and make messages for them
130:             UI.event :encoding, "Adding #{md_file} specified contents:"
131:             
132:             md['Contents'].each do |info|
133:                 name, digest, purpose = info['Name'], info['Digest'], info['Purpose']
134:                 
135:                 UI.event :encoding, "#{name} - #{digest} - #{purpose}"
136:                 # encode the contents as a base64 chunk
137:                 part = RMail::Message.new
138:                 part.header['Content-Disposition'] = "attachment; filename=#{name}"
139:                 part.header['Content-Type'] = "x-application/fastcst; name=#{name}"
140:                 part.header['Content-Transfer-Encoding'] = "base64"
141:                 part.body = Base64.encode64(File.read(name))
142:                 
143:                 message.add_part(part)
144:             end
145:         end
146:         
147:         to_send = RMail::Serialize.write('', message)
148: 
149:         # and now we just send, MAGIC!
150:         UI.start_finish("Sending message") do
151:             Net::SMTP.start(server, port) do |smtp|
152:                 smtp.send_message to_send, from, to_addr
153:             end
154:         end
155:     end