Chilkat----开源站点之VS2010 CKMailMan一个很好的邮件发送开源开发包
2016-04-19 20:34
609 查看
Chilkat 是一个很好的开源站点,有各种开源库。
开发语言主要有Classic ASP •C
•
C++ •
C# •
Delphi ActiveX •
Delphi DLL •
Visual FoxPro •
Java •
MFC •
Objective-C •
Perl •
PHP ActiveX •
PHP Extension •
PowerShell •
Python •
Ruby •
SQL Server •
Unicode C •
Unicode C++ •
Visual Basic 6.0 •
VB.NET •
VBScript;
而它支持的平台则有:
Chilkat 主页:http://www.chilkatsoft.com/
开发包下载连接:http://www.chilkatsoft.com/downloads.asp 这里能够依据你的须要下载不同版本号的开发包。
以下我就以win7 x64 + VS2010 C/C++开发一个邮件发送程序样例,做个教程:
首先下载开发包:
一、打开开发包下载页面:http://www.chilkatsoft.com/downloads.asp
选择 Download Chilkat C / C++ Libraries,如图:
点击后进入了。http://www.chilkatsoft.com/downloads_CPP.asp。假设你的其它平台请自行选择,我的是windows 所以我选择例如以下:
点击进去后就是开发版本号的选择了,不要着急向下滑动,选择你须要的开发包。我的是VS2010 我的选择例如以下:
下载后。将他解压到一个目下。我解压到我的D盘,解压的文件有三个。include,libs,license.txt如图,
----------------------------------------------------------------------------------
二、接下来就是配置我们的VS2010了
过程例如以下:
1、创建一个測试project:
2、加入包括头文件,刚才解压在D盘还记得吗?呵呵:
3、加入lib库我这里拿ChilkatDbg.lib演示,还要加入其它的库哟!完整的例如以下
crypt32.lib
ws2_32.lib
D:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib
3.加入实例代码。我这里直接贴出来:
//官网上关于邮件发送的说明文档连接:http://www.example-code.com/cpp/mht_emailHtmlFile.asp
//关于邮件开发文档:http://www.example-code.com/cpp/smtp.asp
//这里有很多开发样例。点击左边的选择框。就能看到不同方法,然后点击自己想要的样例就能够了。
//CKMailTest.cpp
#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include "../include/CkMailMan.h"
#include "../include/CkEmail.h"
#include "../include/CkMht.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
开发语言主要有Classic ASP •C
•
C++ •
C# •
Delphi ActiveX •
Delphi DLL •
Visual FoxPro •
Java •
MFC •
Objective-C •
Perl •
PHP ActiveX •
PHP Extension •
PowerShell •
Python •
Ruby •
SQL Server •
Unicode C •
Unicode C++ •
Visual Basic 6.0 •
VB.NET •
VBScript;
而它支持的平台则有:
MS Visual C/C++ Linux/CentOS/Heroku C/C++ MAC OS X C/C++ C++ Builder | Solaris C/C++ iOS C/C++ Android C/C++ Raspberry Pi C/C++ | Embedded Linux C/C++ (ARM, MIPS, PowerLinux) FreeBSD C/C++ HP-UX C/C++ MinGW C/C++ |
开发包下载连接:http://www.chilkatsoft.com/downloads.asp 这里能够依据你的须要下载不同版本号的开发包。
以下我就以win7 x64 + VS2010 C/C++开发一个邮件发送程序样例,做个教程:
首先下载开发包:
一、打开开发包下载页面:http://www.chilkatsoft.com/downloads.asp
选择 Download Chilkat C / C++ Libraries,如图:
点击后进入了。http://www.chilkatsoft.com/downloads_CPP.asp。假设你的其它平台请自行选择,我的是windows 所以我选择例如以下:
点击进去后就是开发版本号的选择了,不要着急向下滑动,选择你须要的开发包。我的是VS2010 我的选择例如以下:
下载后。将他解压到一个目下。我解压到我的D盘,解压的文件有三个。include,libs,license.txt如图,
----------------------------------------------------------------------------------
二、接下来就是配置我们的VS2010了
过程例如以下:
1、创建一个測试project:
2、加入包括头文件,刚才解压在D盘还记得吗?呵呵:
3、加入lib库我这里拿ChilkatDbg.lib演示,还要加入其它的库哟!完整的例如以下
crypt32.lib
ws2_32.lib
D:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib
3.加入实例代码。我这里直接贴出来:
//官网上关于邮件发送的说明文档连接:http://www.example-code.com/cpp/mht_emailHtmlFile.asp
//关于邮件开发文档:http://www.example-code.com/cpp/smtp.asp
//这里有很多开发样例。点击左边的选择框。就能看到不同方法,然后点击自己想要的样例就能够了。
//CKMailTest.cpp
#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include "../include/CkMailMan.h"
#include "../include/CkEmail.h"
#include "../include/CkMht.h"
void ChilkatSample(void) { // The mailman object is used for sending and receiving email. CkMailMan mailman; // Any string argument automatically begins the 30-day trial. bool success; success = mailman.UnlockComponent("30-day trial"); if (success != true) { printf("%s\n",mailman.lastErrorText()); return; } // Set the SMTP server. mailman.put_SmtpHost("smtp.chilkatsoft.com"); // Set the SMTP login/password (if required) mailman.put_SmtpUsername("myUsername"); mailman.put_SmtpPassword("myPassword"); // Create a new email object CkEmail email; email.put_Subject("This is a test"); email.put_Body("This is a test"); email.put_From("Chilkat Support <support@chilkatsoft.com>"); email.AddTo("Chilkat Admin","admin@chilkatsoft.com"); // To add more recipients, call AddTo, AddCC, or AddBcc once per recipient. // Call SendEmail to connect to the SMTP server and send. // The connection (i.e. session) to the SMTP server remains // open so that subsequent SendEmail calls may use the // same connection. success = mailman.SendEmail(email); if (success != true) { printf("%s\n",mailman.lastErrorText()); return; } // Some SMTP servers do not actually send the email until // the connection is closed. In these cases, it is necessary to // call CloseSmtpConnection for the mail to be sent. // Most SMTP servers send the email immediately, and it is // not required to close the connection. We'll close it here // for the example: success = mailman.CloseSmtpConnection(); if (success != true) { printf("Connection to SMTP server not closed cleanly.\n"); } printf("Mail Sent!\n"); }
int _tmain(int argc, _TCHAR* argv[])
{
ChilkatSample();//直接调用
return 0;
}
相关文章推荐
- 03-树3 Tree Traversals Again (25分)
- 结对项目——fault,error,failure的程序设计
- Given an array nums, write a function to move all 0's to the end of it while maintaining the relativ
- 山东省第五届ACM大学生程序设计竞赛-angry_birds_again_and_again(积分)
- exmail 清空队列中某个用户邮件
- POJ 3421 X-factor Chains【分解质因子+组合数学】
- mybaits不能出现小于号
- FZOJ 2216 The Longest Straight (尺取法)
- warning C4819 解决方案 warning C4819: The file contains a character that cannot be represented in the cu
- grails框架数据查询
- IntelliJ 自动创建main函数 for循环 try catch模块
- 70. Climbing Stairs
- ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction(死锁)
- 11. Container With Most Water
- HDU 1104 remainder
- SFTP 上传文件报错:SFTP ERROR?Algorithm negotiation fail
- ERROR 1215 (HY000): Cannot add foreign key constraint 解决方法
- [2016-04-19 15:46:03 - IceHoloReader1.0] Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER [20
- Jenkins进阶系列之——02email-ext邮件通知模板
- AssertionFailedError