Ruby Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
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
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

Ruby to Send Russian Email

Downloads for Windows/Linux and Install Instructions

Ruby script to send Russian email.

# file: SendRussianEmail.rb

# This source file was saved using the iso-8859-5  character encoding.
# I recommend the "EM Editor" by Emurasoft as a simple editor for editing Ruby source
# in various character encodings.

require 'rubygems'
require 'chilkat'

# Ruby script to send email containing Russian characters
mailman = Chilkat::CkMailMan.new()
mailman.UnlockComponent("anything for 30-day trial")

# SMTP hostname
mailman.put_SmtpHost("smtp.comcast.net")

# If your SMTP server requires a login, set login/password
# mailman.put_SmtpUsername("myUsername")
# mailman.put_SmtpPassword("myPassword")

# We need CkString to help with Russian/iso-8859-5 
s1 = Chilkat::CkString.new()
s1.appendEnc("В чащах юга жил-был цитрус? Да, но фальшивый экземпляр! ёъ.","iso-8859-5")

# Create a new email object
email = Chilkat::CkEmail.new()
# Indicate that string input/output to the email object will be utf-8.
email.put_Utf8(true)
# Use Russian characters in the subject, body, etc.
email.put_Subject(s1.getUtf8())
email.put_Body(s1.getUtf8())
email.put_From("Support <support@chilkatsoft.com>")

# Add a few recipients
email.AddTo("Matt","matt@chilkatsoft.com")
email.AddTo("Somebody","somebody@somewhere.com")

# Chilkat automatically recognizes the Russian characters and chooses
# a typical charset for Russian email: iso-8859-5  .
# Had the email contained characters not representable in iso-8859-5 (such as Chinese 
# characters) the component would have automatically chosen utf-8 as the encoding.

# The charset used throughout the entire email can be explicitly changed by setting
# the Charset property:
#email.put_Charset("utf-8")

# The following line of code is not required for this example.
# It saves the MIME source of the email so it can be reviewed
# in a text editor.
email.SaveEml("email.eml")

success = mailman.SendEmail(email)
if not success
	mailman.SaveLastError("lastError.xml")
end

 

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