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 Greek Email

Downloads for Windows/Linux and Install Instructions

Ruby script to send Greek email.

# file: SendGreekEmail.rb

# This source file was saved using the iso-8859-7  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 Greek 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 Greek/iso-8859-7 
s1 = Chilkat::CkString.new()
s1.appendEnc("Μπορώ να φάω σπασμένα γυαλιά χωρίς να πάθω τίποτα.","iso-8859-7")

# 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 Greek 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 Greek characters and chooses
# a typical charset for Greek email: iso-8859-7  .
# Had the email contained characters not representable in iso-8859-7 (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.