资源简介
使用outlook的com接口发送邮件。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

代码片段和文件信息
// sendmail1.cpp : Defines the entry point for the application.
//
#include “stdafx.h“
#include “sendmail1.h“
#include
#include
#include
#include “mapi.h“
#include “common/common.h“
using namespace std;
#pragma warning(disable:4996)
// laterbind.cpp : 定义控制台应用程序的入口点。
//
void Error(char* pDta)
{
if (!pDta)
{
return;
}
FILE* pFile = NULL;
fopen_s(&pFile “error.txt“ “ab+“);
if (!pFile)
{
return;
}
fwrite(pDta 1 strlen(pDta) pFile);
time_t timer;//time_t就是long int 类型
struct tm *tblock = NULL;
timer = time(NULL);//这一句也可以改成time(&timer);
tblock = localtime( &timer);
if( tblock)
{
char szDta[1024] = { 0 };
sprintf_s(szDta 1024 “\t%d/%d/%d %d:%d:%d\r\n“ 1900+tblock->tm_year tblock->tm_mon tblock->tm_mday tblock->tm_hour tblock->tm_min tblock->tm_sec);
fwrite(szDta 1 strlen(szDta) pFile);
}
fclose(pFile);
}
#include “stdafx.h“
struct Wrap_errno
{
HRESULT hr;
EXCEPINFO info;
};
Wrap_errno AutoWrap(int autoType VARIANT *pvResult IDispatch *pDisp
LPOLESTR ptName int cArgs...)
{
// Begin variable-argument list
va_list marker;
va_start(marker cArgs);
Wrap_errno err;
memset(&err 0 sizeof err);
if (!pDisp)
{
err.hr = E_INVALIDARG;
return err;
}
// Variables used
DISPPARAMS dp = { NULL NULL 0 0 };
DISPID dispidNamed = DISPID_PROPERTYPUT;
DISPID dispID;
HRESULT hr;
// Get DISPID for name passed
hr = pDisp->GetIDsOfNames(IID_NULL &ptName 1 LOCALE_USER_DEFAULT &dispID);
if (FAILED(hr))
{
err.hr = hr;
return err;
}
// Allocate memory for arguments
VARIANT *pArgs = new VARIANT[cArgs + 1];
// Extract arguments...
for (int i = 0; i < cArgs; i++)
{
pArgs[i] = va_arg(marker VARIANT);
}
// Build DISPPARAMS
dp.cArgs = cArgs;
dp.rgvarg = pArgs;
// Handle special-case for property-puts
if (autoType & DISPATCH_PROPERTYPUT)
{
dp.cNamedArgs = 1;
dp.rgdispidNamedArgs = &dispidNamed;
}
// Make the call
EXCEPINFO excepInfo;
memset(&excepInfo 0 sizeof excepInfo);
hr = pDisp->Invoke(dispID IID_NULL LOCALE_SYSTEM_DEFAULT
autoType &dp pvResult &excepInfo NULL);
if (FAILED(hr))
{
err.hr = hr;
err.info = excepInfo;
delete[] pArgs;
return err;
}
// End variable-argument section
va_end(marker);
delete[] pArgs;
return err;
}
Wrap_errno SendMail_UsingOOM(
const std::wstring &to
const std::wstring &cc
const std::wstring &bcc
const std::wstring &subject
const std::wstring &body
const std::wstring &attachmentPath
bool showUI
)
{
CoInitializeEx(NULL COINIT_APARTMENTTHREADED);
// Define vtMissing for optional parameters in some calls.
VARIANT vtMissing;
vtMissing.vt = VT_EMPTY;
CLSID clsid;
HRESULT hr;
Wrap_errno err;
memset(&err 0 sizeof err);
LPCOLESTR progID = L“Outlook.Application“;
hr = CLSIDFromProgID(progID &clsid);
if (FAILED
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-15 22:10 sendmail1\
目录 0 2018-05-15 22:10 sendmail1\.vs\
目录 0 2018-05-15 22:10 sendmail1\.vs\sendmail1\
目录 0 2018-05-15 22:10 sendmail1\.vs\sendmail1\v14\
文件 36864 2018-05-15 22:07 sendmail1\.vs\sendmail1\v14\.suo
目录 0 2018-05-15 22:10 sendmail1\Debug\
文件 356352 2018-05-15 22:06 sendmail1\Debug\sendmail1.exe
文件 1751764 2018-05-15 22:06 sendmail1\Debug\sendmail1.ilk
文件 5050368 2018-05-15 22:06 sendmail1\Debug\sendmail1.pdb
目录 0 2018-05-15 22:10 sendmail1\Release\
文件 130560 2018-05-15 22:07 sendmail1\Release\sendmail1.exe
文件 929725 2018-05-15 22:07 sendmail1\Release\sendmail1.iobj
文件 196752 2018-05-15 22:07 sendmail1\Release\sendmail1.ipdb
文件 2871296 2018-05-15 22:07 sendmail1\Release\sendmail1.pdb
目录 0 2018-05-15 22:10 sendmail1\sendmail1\
文件 2600 2018-05-15 20:13 sendmail1\sendmail1\ReadMe.txt
文件 743 2018-05-15 20:13 sendmail1\sendmail1\Resource.h
目录 0 2018-05-15 22:10 sendmail1\sendmail1\common\
文件 10028 2017-04-20 13:48 sendmail1\sendmail1\common\CComputerInfo.cpp
文件 427 2017-03-22 14:48 sendmail1\sendmail1\common\CComputerInfo.h
目录 0 2018-05-15 22:10 sendmail1\sendmail1\common\DuiLib\
文件 1153 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\CMakeLists.txt
目录 0 2018-05-15 22:10 sendmail1\sendmail1\common\DuiLib\Control\
文件 40618 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UIActiveX.cpp
文件 1958 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UIActiveX.h
文件 14421 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UIButton.cpp
文件 1996 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UIButton.h
文件 526 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UICheckBox.cpp
文件 800 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UICheckBox.h
文件 41410 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UICombo.cpp
文件 4613 2016-11-09 11:27 sendmail1\sendmail1\common\DuiLib\Control\UICombo.h
............此处省略229个文件信息
相关资源
- Rational Rose Common破解文件
-
Windows em
bedded Compact 2013 应用开发调 - VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- VESA Computer Display Monitor Timing (DMT)
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
- 一个扩展的CComboBox 下拉框 自绘 美化
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
- 多项式求和(数据结构C 版)
- vc 6.0开发的流程图编辑器
评论
共有 条评论