C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


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

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

Using an Alternative FROM Address for SMTP

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

Demonstrates how to call SendMime instead of SendEmail to pass a FROM address and RCPT TO addresses that are different than what is specified in the email header.

            // Demonstrates how to call SendMime so that the FROM address in the 
            // MIME header may be different than the FROM address passed to the SMTP server  
            // during the SMTP protocol conversation.
            Chilkat.MailMan mailman = new Chilkat.MailMan();
            mailman.UnlockComponent("anything for 30-day trial");

            mailman.SmtpHost = "smtp.comcast.net";

            Chilkat.Email email = new Chilkat.Email();
            email.Subject = "Subject for C# email example";
            email.Body = "Body for C# email example code";
            email.AddTo("Chilkat Admin", "admin@chilkatsoft.com");
            email.AddFileAttachment("someFile.pdf");

            // Normally, when SendEmail is called, the FromAddress
            // is passed to the SMTP server as the argument to the FROM
            // command (during the SMTP protocol conversation).
            // It is also the address found in the "From" MIME header field
            // of the email.
            email.FromName = "Chilkat Support";
            email.FromAddress = "support@chilkatsoft.com";

            // In this example, we'll send the email by calling mailman.SendMime
            // This allows us to provide recipients and a "From" address that may
            // be different than what is in the MIME header of the email.
            string mime = email.GetMime();

            string recipientList;
            string smtpFrom;
            smtpFrom = "joe@mycompany.com";
            recipientList = "admin@chilkatsoft.com, support@chilkatsoft.com";
            
            // The "joe@mycompany.com" will appear in the "Received" header field
            // of the email, like this:
            /*
             * Received: from unknown (HELO ****.comcast.net) ([206.18.177.52]) 
                  (envelope-sender <joe@mycompany.com>) 
                  by ****.com (qmail-ldap-1.03) with SMTP 
                  for <admin@chilkatsoft.com>; 5 Aug 2006 02:06:19 -0000 
            */
            bool success = mailman.SendMime(smtpFrom, recipientList, mime);
            if (!success)
            {
                MessageBox.Show(mailman.LastErrorText);
            }
            else
            {
                MessageBox.Show("Mail Sent!");
            }

Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

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

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

Email Component · XML Parser