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
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

Create Signed + Encrypted EML

Ruby script to create an email that is both signed and encrypted.

Download Ruby Programming Example Scripts

# file: CreateSignedEncryptedEml.rb

require 'chilkat'

# How to create a .eml file that is both digitally signed and encrypted.
mailman = Chilkat::CkMailMan.new()
mailman.UnlockComponent("anything for 30-day trial")

# Create a simple email
email = Chilkat::CkEmail.new()
email.put_Subject("Signed + encrypted email in Ruby")
email.put_Body("Signed + encrypted email in Ruby")
email.put_From("Chilkat Support <support@chilkatsoft.com>")
email.AddTo("TagTooga","admin@tagtooga.com")

# Simply indicate that the email is to be signed AND encrypted:
email.put_SendEncrypted(true)
email.put_SendSigned(true)

mimeStr = Chilkat::CkString.new()
# The RenderToMime method renders the email according to the property settings
# of the email and mailman objects.
success = mailman.RenderToMime(email,mimeStr)
if not success
	mailman.SaveLastError("lastError.txt");
else
	# Convert line endings from CRLF to bare LF's
	mimeStr.toLF()
	# Save the MIME string to a file.
	aFile = File.new("secure_email.eml", "w")
	aFile.write(mimeStr.getString())
	aFile.close
end





 

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

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