发送邮件的问题
HMODULE hMod=LoadLibrary("MAPI32.DLL");
if(hMod == NULL)
{
printf("LoadLibrary fail.\n");
return ;
}
ULONG (PASCAL *lpfnSendMail) (ULONG, ULONG, MapiMessage *, FLAGS, ULONG);
(FARPROC &)lpfnSendMail=GetProcAddress(hMod, "MAPISendMail");
if(lpfnSendMail == NULL)
{
printf("GetProcAddress fail.\n");
return ;
}
MapiFileDesc attachment=
{
0, // ulReserved, must be 0
0, // no flags; this is a data file
(ULONG) - 1, // position not specified
argv[0], // pathname, if original filename is NULL, this is the filename
NULL, // original filename
NULL
}; // MapiFileTagExt unused
MapiRecipDesc recip={ 0, MAPI_TO,"nowcan", "nowcan@163.com", 0, NULL };
MapiMessage message=
{
0, // reserved, must be 0
"测试", // subject
"我在csdn的名称是\n\nBIOS测试结果见附件。", // note text
NULL, // NULL = interpersonal message
NULL, // no date; MAPISendMail ignores it
NULL, // no conversation ID
0L, // no flags, MAPISendMail ignores it
NULL, // no originator, this is ignored too
1, // recipients
&recip, // recipient array
1, // one attachment
&attachment
}; // the attachment structure
int nError=lpfnSendMail(0, 0, &message, MAPI_LOGON_UI | MAPI_DIALOG, 0);
// after returning from the MAPISendMail call, the window must
// be re-enabled and focus returned to the frame to undo the workaround
// done before the MAPI call.
if(nError != SUCCESS_SUCCESS && nError != MAPI_USER_ABORT && nError != MAPI_E_LOGIN_FAILURE)
{
printf("SendMail fail.\n");
}
FreeLibrary(hMod);
这段代码可以用来发邮件,在控制台里完全没有问题,如果普通的就会有问题,弹出来的outlook窗体不能控制,不知道什么原因,请指教,这个代码是在nowcan的网站的
if(hMod == NULL)
{
printf("LoadLibrary fail.\n");
return ;
}
ULONG (PASCAL *lpfnSendMail) (ULONG, ULONG, MapiMessage *, FLAGS, ULONG);
(FARPROC &)lpfnSendMail=GetProcAddress(hMod, "MAPISendMail");
if(lpfnSendMail == NULL)
{
printf("GetProcAddress fail.\n");
return ;
}
MapiFileDesc attachment=
{
0, // ulReserved, must be 0
0, // no flags; this is a data file
(ULONG) - 1, // position not specified
argv[0], // pathname, if original filename is NULL, this is the filename
NULL, // original filename
NULL
}; // MapiFileTagExt unused
MapiRecipDesc recip={ 0, MAPI_TO,"nowcan", "nowcan@163.com", 0, NULL };
MapiMessage message=
{
0, // reserved, must be 0
"测试", // subject
"我在csdn的名称是\n\nBIOS测试结果见附件。", // note text
NULL, // NULL = interpersonal message
NULL, // no date; MAPISendMail ignores it
NULL, // no conversation ID
0L, // no flags, MAPISendMail ignores it
NULL, // no originator, this is ignored too
1, // recipients
&recip, // recipient array
1, // one attachment
&attachment
}; // the attachment structure
int nError=lpfnSendMail(0, 0, &message, MAPI_LOGON_UI | MAPI_DIALOG, 0);
// after returning from the MAPISendMail call, the window must
// be re-enabled and focus returned to the frame to undo the workaround
// done before the MAPI call.
if(nError != SUCCESS_SUCCESS && nError != MAPI_USER_ABORT && nError != MAPI_E_LOGIN_FAILURE)
{
printf("SendMail fail.\n");
}
FreeLibrary(hMod);
这段代码可以用来发邮件,在控制台里完全没有问题,如果普通的就会有问题,弹出来的outlook窗体不能控制,不知道什么原因,请指教,这个代码是在nowcan的网站的
...全文
相关推荐
浅析JavaMail发送邮件后再通过JavaMail接收格式问题
本文将介绍JavaMail发送邮件后再通过JavaMail接收格式问题,主要讨论邮件发送和接收的格式问题,以及如何正确地解析邮件中的图片、附件等内容。
解决Yii2邮件发送结果返回成功,但接收不到邮件的问题
"本文主要探讨了在使用Yii2框架发送邮件时遇到的一个常见问题:邮件发送结果显示成功,但实际上并未收到邮件。文章通过分析配置文件和控制器代码,提供了解决这个问题的方案,适合遇到类似问题的开发者参考。
Python SMTP发送邮件遇到的一些问题及解决办法
"Python通过SMTP发送邮件的问题及解决方案"在使用Python进行SMTP(Simple Mail Transfer Protocol)邮件发送时,开发者可能会遇到各种问题。本篇内容将介
web版邮件接收发送问题
这里,我们聚焦于Java Web版邮件接收发送的问题,以及如何通过提供的文件来理解这个问题。首先,我们要知道Java中处理邮件的主要API是JavaMail API。
Java实现邮件发送遇到的问题
Java 实现邮件发送时可能遇到的问题及解决方案在开发项目中,使用 Java 来实现邮件发送功能是一项常见的任务。


