资源简介
使用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个文件信息
相关资源
- LR1语法分析器
- 编译原理 第二版 刘坚 课后习题答案
- vs2017安装包community
- commvault备份系统基本原理.zip
- Multi-Touch Piano Complete Audio Keyboard
- ModelSim_command reference manual 10.5c.pdf
- windows commands2019.pdf
- Solution Manual for Computer Networking: A Top
- Sass和Compass 实战
- 采用时间片轮转算法的进程调度程序
- Crafting a compiler120633
- Vue简单评论组件代码
- RTKLIB在vsvc中的调试,包括了需要的额
- comsol MEMS模块简易教程
- Design compiler 经典入门教程
- PyWin32官方说明文档
- 数独游戏源代码
- 生命游戏源代码
- Tools for Computational Finance.pdf
- Complete Guide to Shodan
- Parallel Computer Organization and Design-Camb
- COMP51编译器
- 深入浅出设计模式中文版高清 pdf
- winsocket 通讯程序
- lua编辑器自定义关键字可带注释
- ComicStudio_EX绿色破解版本
- comsol 仿真
- computer simulation of liquids 2nd
- Synopsys DC 中文教程
- wordpress visual composer 插件
评论
共有 条评论