Ruby Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SFTP
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA

Unreleased...
LZW
Icon

 

 

 

 

 

 

 

Create Multipart/Mixed MIME

Ruby script showing how create a multipart/mixed MIME message.

Download Ruby Programming Example Scripts

# file: mimeMultipartMixed.rb

require 'chilkat'

# Demonstrates how to create a multipart/mixed MIME message
# with 2 sub-parts: a text/plain body and a GIF file attachment.
mime = Chilkat::CkMime.new()
mime.UnlockComponent("anything for 30-day trial")
	    
# Initialize to a multipart/mixed content-type:
mime.NewMultipartMixed()
		
# Create a text/plain MIME part.
textBody = Chilkat::CkMime.new()
textBody.SetBodyFromPlainText("This is the plain-text body!\nThank you.")
		
# Add it as a child to the multipart/mixed parent:
mime.AppendPart(textBody)
		
# Load a GIF file as a new sub-part:
mime.AppendPartFromFile("images/dudeRuby.gif")
		
# Chilkat automatically generates a unique boundary string.
# Need to change it?  Do this:
mime.put_Boundary("123--ABC--Blah-blah-blah")
		
# Print the MIME message:
print mime.mime() + "\n\n"
				
# Prints this MIME:
# 
# content-type: multipart/mixed;
# 	boundary="123--ABC--Blah-blah-blah"
# 
# This is a multi-part message in MIME format.
# 
# --123--ABC--Blah-blah-blah
# 
# This is the plain-text body!
# Thank you.
# --123--ABC--Blah-blah-blah
# content-disposition: attachment;
# 	 filename="dudeRuby.gif"
# content-transfer-encoding: base64
# content-type: image/gif;
# 	name="dudeRuby.gif"
# 
# R0lGODlhZABkAPf/AP////ry8vrx8Pnx8fnw8PXn5vXl5PTk4/Pg4PPf3/DX1+7Pz+3R0e3L
# y+zQz+vg4OvV1evKyuvDw+rk5Ojo6Oi/v+fBweW6uuS/v+O/v+Kvr+G/v+Gyst6kpNyWltui
# otqurdm4uNmMi9eendePj9eIh9bKyta1tdW+vtWTk9WSkdOPj9KmpdJ5eNGAgNCEhMy8vMp1
# ...
# OPmTL5ERCSRh53on0rlzwUcT7AZO8ctyUFat+gR4UEKNQyplMJkekRCqDxEgERAAOw==
# 
# --123--ABC--Blah-blah-blah--
# 



 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.