Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Email in JavaThis simplest possible program to send a basic email in Java using Chilkat. import com.chilkatsoft.CkMailMan; import com.chilkatsoft.CkEmail; public class EmailSimpleSend { static { try { System.loadLibrary("chilkat"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } // Simple example showing how to send email in Java public static void main(String argv[]) { CkMailMan mailman = new CkMailMan(); mailman.UnlockComponent("anything for 30-day trial"); // Set your SMTP server's hostname mailman.put_SmtpHost("smtp.comcast.net"); // If your SMTP server requires a login, set username/password //mailman.put_SmtpUsername("myUsername"); //mailman.put_SmtpPassword("myPassword"); // Create a simple email CkEmail email = new CkEmail(); email.put_Subject("Sending mail from Java"); email.put_Body("This email was sent from a Java program"); email.put_From("Chilkat Support <support@chilkatsoft.com>"); // Add a few recipients email.AddTo("Matt","matt@chilkatsoft.com"); email.AddTo("TagTooga","admin@tagtooga.com"); boolean success = mailman.SendEmail(email); if (!success) { mailman.SaveLastError("lastError.txt"); } } } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.