Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
Send High Priority Email
C++ source code to send high-priority mail. #define _CRTDBG_MAP_ALLOC #include <windows.h> #include <stdio.h> #include <crtdbg.h> #include "C:/ck2000/components/ChilkatLib/Package/Include/CkSettings.h" #include "C:/ck2000/components/ChilkatLib/Package/Include/CkEmail.h" #include "C:/ck2000/components/ChilkatLib/Package/Include/CkEmailBundle.h" #include "C:/ck2000/components/ChilkatLib/Package/Include/CkMailMan.h" #include "C:/ck2000/components/ChilkatLib/Package/Include/CkString.h" #include "C:/ck2000/components/ChilkatLib/Package/Include/CkByteData.h" void EmailExample(void) { CkMailMan mailman; // Any string passed to UnlockComponent begins the 30-day trial. bool unlocked = mailman.UnlockComponent("30-day trial"); if (!unlocked) { printf("Failed to unlock component\n"); return; } mailman.put_SmtpHost("mail.earthlink.net"); // Send a high-priority email. CkEmail email; //You can add the X-Priority header field and give it the value string "1". //For example: email.AddHeaderField "X-Priority","1" This is the most common way of // setting the priority of an email. "3" is normal, and "5" is the lowest. // "2" and "4" are in-betweens, and frankly I've never seen anything // but "1" or "3" used. Microsoft Outlook adds these header fields when // setting a message to High priority: // X-Priority: 1 (Highest) // X-MSMail-Priority: High // Importance: High email.AddHeaderField("X-Priority","1"); email.put_Body("This is the email body"); email.AddTo("Chilkat Support","support@chilkatsoft.com"); email.put_FromAddress("somebody@chilkatsoft.com"); email.put_Subject("This is the email subject"); // Send the email if (!mailman.SendEmail(&email)) { mailman.SaveLastError("errors.xml"); } } int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { freopen("stdout.txt","w",stdout); EmailExample(); CkSettings::cleanupMemory(); _CrtDumpMemoryLeaks(); return 0; }
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.