Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

632 lines
20 KiB

  1. //
  2. // WebCheck Mail Agent
  3. //
  4. // A user specifies that they are to be notified via email when a web checked
  5. // object (usually a page) changes.
  6. //
  7. // When the subscription is the delivery agent will call the mail agent upon completion
  8. // with a temporary ISubscriptionItem
  9. //
  10. // Julian Jiggins (julianj), January 8, 1997
  11. //
  12. #include "private.h"
  13. #include "mapi.h"
  14. #include "smtp.h"
  15. #include "mlang.h"
  16. #include <mluisupp.h>
  17. #undef TF_THISMODULE
  18. #define TF_THISMODULE TF_MAILAGENT
  19. //
  20. // Global strings
  21. // REVIEW move to a better place
  22. //
  23. #define MAIL_HANDLER TEXT("Software\\Clients\\Mail")
  24. #define MAIL_ATHENA TEXT("Internet Mail and News")
  25. #define SUBJECT_LINE TEXT("Subscription delivered")
  26. #define MESSAGE_PREFIX TEXT(" \r\nThe website you requested ")
  27. #define MESSAGE_SUFFIX TEXT(" has been delivered")
  28. #define ATHENA_SMTP_SERVER \
  29. TEXT("Software\\Microsoft\\Internet Mail and News\\Mail\\SMTP")
  30. #define NETSCAPE_SMTP_SERVER \
  31. TEXT("Software\\Netscape\\netscape Navigator\\Services\\SMTP_Server")
  32. #define EUDORA_COMMANDLINE TEXT("Software\\Qualcomm\\Eudora\\CommandLine")
  33. #define NOTE_TEXT_LENGTH 4096
  34. #define ENCODING_STRLEN 32
  35. //////////////////////////////////////////////////////////////////////////
  36. //
  37. // Email helper functions
  38. //
  39. //////////////////////////////////////////////////////////////////////////
  40. //
  41. // Returns a MemAlloc'd string with HTMLBreak inserted in place of '\d'.
  42. //
  43. void AddHTMLBreakText(LPSTR szText, LPSTR szHTMLBreak, LPSTR *lpHTMLText)
  44. {
  45. ASSERT(szText);
  46. ASSERT(szHTMLBreak);
  47. ASSERT(!*lpHTMLText);
  48. LPSTR lpTmp = NULL, lpTmp2 = NULL, lpHTMLAbstract = NULL;
  49. int cbCRs = 0;
  50. int cbLFs = 0;
  51. DWORD dwExtra = 0;
  52. //
  53. // Count number of carriage returns
  54. //
  55. for (lpTmp = szText; *lpTmp; lpTmp++)
  56. {
  57. if (*lpTmp == 0x0d)
  58. cbCRs++;
  59. if (*lpTmp == 0x0a)
  60. cbLFs++;
  61. }
  62. dwExtra = lstrlenA(szText) - cbCRs - cbLFs + cbCRs * lstrlenA(szHTMLBreak) + 1;
  63. //
  64. // Allocate appropriate size string
  65. //
  66. *lpHTMLText = lpHTMLAbstract = (LPSTR)MemAlloc(LPTR, dwExtra);
  67. if (!lpHTMLAbstract)
  68. return;
  69. //
  70. // Create new HTML abstract string.
  71. //
  72. for (lpTmp = szText; *lpTmp; lpTmp++)
  73. {
  74. if (*lpTmp == 0x0d)
  75. {
  76. for (lpTmp2 = szHTMLBreak; *lpTmp2; lpTmp2++, lpHTMLAbstract++)
  77. *lpHTMLAbstract = *lpTmp2;
  78. }
  79. else if (*lpTmp != 0x0a)
  80. {
  81. *lpHTMLAbstract = *lpTmp;
  82. lpHTMLAbstract++;
  83. }
  84. }
  85. *lpHTMLAbstract = '\0';
  86. }
  87. #ifdef DEBUG
  88. void DBG_OUTPUT_MAPI_ERROR(ULONG ul)
  89. {
  90. switch(ul)
  91. {
  92. case MAPI_E_LOGON_FAILURE:
  93. DBG("MailAgent: MAPI LOGON FAILURE"); break;
  94. case MAPI_E_FAILURE:
  95. DBG("MailAgent: MAPI_E_FAILURE"); break;
  96. default:
  97. DBG("MailAgent: Failed to send mail message"); break;
  98. }
  99. }
  100. #else
  101. #define DBG_OUTPUT_MAPI_ERROR(ul)
  102. #endif
  103. //
  104. // Build an HTML message containing a frameset that effectively inlines
  105. // the requested URL
  106. //
  107. BOOL BuildHTMLMessage(LPSTR szEmailAddress, LPSTR szName, LPSTR szURL,
  108. CHAR **ppHTMLMessage, LPSTR szTitle, LPSTR szAbstract,
  109. LPSTR szSrcCharset)
  110. {
  111. *ppHTMLMessage = NULL; // clear out parameter
  112. CHAR * lpBuffer = NULL;
  113. CHAR szWrapper[NOTE_TEXT_LENGTH];
  114. CHAR szMessageFormat[NOTE_TEXT_LENGTH];
  115. CHAR szMessageFormat2[NOTE_TEXT_LENGTH];
  116. CHAR szMessageText[NOTE_TEXT_LENGTH];
  117. CHAR szMessageHTML[NOTE_TEXT_LENGTH];
  118. CHAR szTextBreak[10];
  119. CHAR szHTMLBreak[10];
  120. //
  121. // Load the wrapper for the HTML message. This is the header stuff
  122. // and multipart MIME and HTML goop
  123. //
  124. int iRet = MLLoadStringA(IDS_AGNT_HTMLMESSAGEWRAPPER, szWrapper, NOTE_TEXT_LENGTH);
  125. ASSERT(iRet > 0);
  126. if (szTitle != NULL) {
  127. // NOTE: Size is probably slightly larger than necessary due to %1's.
  128. LPSTR lpHTMLAbstract = NULL, lpNewAbstract = NULL;
  129. DWORD dwTotalSize = 0;
  130. //
  131. // load string for single HTML line break as well as tag on for custom email
  132. //
  133. MLLoadStringA(IDS_AGNT_EMAILMESSAGE, szMessageText, ARRAYSIZE(szMessageText));
  134. MLLoadStringA(IDS_AGNT_HTMLBREAKSINGLE, szHTMLBreak, ARRAYSIZE(szHTMLBreak));
  135. //
  136. // Create new abstract string (szAbstract + email tagger)
  137. //
  138. dwTotalSize = lstrlenA(szAbstract) + lstrlenA(szMessageText) + 1;
  139. LPSTR szNewAbstract = (LPSTR)MemAlloc(LPTR, dwTotalSize * sizeof(CHAR));
  140. if (!szNewAbstract)
  141. return FALSE;
  142. lstrcpynA(szNewAbstract, szAbstract, dwTotalSize);
  143. StrCatBuffA(szNewAbstract, szMessageText, dwTotalSize);
  144. AddHTMLBreakText(szNewAbstract, szHTMLBreak, &lpHTMLAbstract);
  145. if (!lpHTMLAbstract)
  146. {
  147. MemFree(szNewAbstract);
  148. return FALSE;
  149. }
  150. dwTotalSize = lstrlenA(szWrapper) + lstrlenA(szEmailAddress) +
  151. 2*lstrlenA(szTitle) + lstrlenA(szNewAbstract) + lstrlenA(szSrcCharset) +
  152. lstrlenA(lpHTMLAbstract) + lstrlenA(szURL) + 1;
  153. lpBuffer = (CHAR *)MemAlloc(LPTR, dwTotalSize * sizeof(CHAR));
  154. if (!lpBuffer)
  155. return FALSE;
  156. LPSTR lpArguments[6];
  157. lpArguments[0] = szEmailAddress;
  158. lpArguments[1] = szTitle;
  159. lpArguments[2] = szNewAbstract;
  160. lpArguments[3] = szSrcCharset; // the charset of the HTML page
  161. lpArguments[4] = szURL;
  162. lpArguments[5] = lpHTMLAbstract;
  163. //
  164. // Reason for FormatMessage is that wsprintf is limited up to 1024 bytes
  165. //
  166. FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  167. szWrapper, 0, 0, lpBuffer, dwTotalSize, (va_list *)&lpArguments[0]);
  168. MemFree(szNewAbstract);
  169. MemFree(lpHTMLAbstract);
  170. } else {
  171. //
  172. // Load line breaks for the plaintext and html messages
  173. //
  174. iRet = MLLoadStringA(IDS_AGNT_TEXTBREAK, szTextBreak, ARRAYSIZE(szTextBreak));
  175. ASSERT(iRet > 0);
  176. iRet = MLLoadStringA(IDS_AGNT_HTMLBREAK, szHTMLBreak, ARRAYSIZE(szHTMLBreak));
  177. ASSERT(iRet > 0);
  178. //
  179. // Load the actual text message to put sent
  180. //
  181. iRet = MLLoadStringA(IDS_AGNT_HTMLMESSAGETEXT, szMessageFormat, NOTE_TEXT_LENGTH);
  182. ASSERT(iRet > 0);
  183. iRet = MLLoadStringA(IDS_AGNT_HTMLMESSAGETEXT2, szMessageFormat2, NOTE_TEXT_LENGTH);
  184. ASSERT(iRet > 0);
  185. //
  186. // Insert the text messages into the wrapper. Note two message get
  187. // Once in the mime section for text/ascii and once in the
  188. // noframes section of the text/html frameset. This is a work around
  189. // for clients (like Outlook) that think they can render HTML
  190. // but cannot really.
  191. // The second message IDS_AGNT_HTMLMESSAGETEXT2 should NOT be localized
  192. // this is only going to be seen by Exchange users. In the future exchange
  193. // will handle html mail correct, so it acceptable that for example
  194. // Japanese Exchange users see english in this message. Most Japanese
  195. // users will user Outlook Express and so will just see the html message
  196. //
  197. // First we format 2 text messages, one for text and one for HTML,
  198. // since message itself is relatively small we know its < 1024 bytes
  199. iRet = wnsprintfA(szMessageText, ARRAYSIZE(szMessageText), szMessageFormat,
  200. szName, szTextBreak, szURL, szTextBreak);
  201. ASSERT(iRet > lstrlenA(szMessageFormat));
  202. iRet = wnsprintfA(szMessageHTML, ARRAYSIZE(szMessageHTML), szMessageFormat2,
  203. szName, szHTMLBreak, szURL, szHTMLBreak);
  204. ASSERT(iRet > lstrlenA(szMessageFormat2));
  205. DWORD dwTotalSize = lstrlenA(szWrapper) + lstrlenA(szEmailAddress) +
  206. lstrlenA(szName) + lstrlenA(szMessageText) + lstrlenA(szSrcCharset) +
  207. lstrlenA(szMessageHTML) + lstrlenA(szURL) + 1;
  208. lpBuffer = (CHAR *)MemAlloc(LPTR, dwTotalSize * sizeof(CHAR));
  209. if (!lpBuffer)
  210. return FALSE;
  211. LPSTR lpArguments[6];
  212. lpArguments[0] = szEmailAddress; // target email address
  213. lpArguments[1] = szName; // the name of the page that goes in the subject line
  214. lpArguments[2] = szMessageText; // the plain text message
  215. lpArguments[3] = szSrcCharset; // the charset of the HTML page
  216. lpArguments[4] = szURL; // the href of the page that goes in the frame set
  217. lpArguments[5] = szMessageHTML; // the plain text message that goes in the
  218. // noframes part of the frameset
  219. DWORD dwRet;
  220. dwRet = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  221. szWrapper, 0, 0, lpBuffer, dwTotalSize, (va_list *)&lpArguments[0]);
  222. ASSERT(dwRet);
  223. }
  224. *ppHTMLMessage = lpBuffer;
  225. return TRUE;
  226. }
  227. //
  228. // Build the actual text of the message to be sent via SMTP,
  229. // load format string from resource and insert URL and URL's friently name.
  230. //
  231. void BuildSMTPMessage(LPSTR szName, LPSTR szURL, LPSTR *szMessage,
  232. LPSTR szTitle, LPSTR szAbstract)
  233. {
  234. CHAR szFormatText[NOTE_TEXT_LENGTH];
  235. int i;
  236. ASSERT(szMessage);
  237. if (!szMessage)
  238. return;
  239. *szMessage = NULL;
  240. if (szTitle != NULL) {
  241. i = MLLoadStringA(IDS_AGNT_SMTPMESSAGE_OTHER, szFormatText, NOTE_TEXT_LENGTH);
  242. ASSERT(i != 0);
  243. DWORD dwLen = lstrlenA(szFormatText) + lstrlenA(szTitle) + lstrlenA(szAbstract) + 1;
  244. *szMessage = (LPSTR) MemAlloc(LPTR, dwLen * sizeof(CHAR));
  245. if (!*szMessage)
  246. return;
  247. LPSTR lpArgs[2];
  248. lpArgs[0] = szTitle;
  249. lpArgs[1] = szAbstract;
  250. FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  251. szFormatText, 0, 0, *szMessage, dwLen, (va_list *)&lpArgs[0]);
  252. } else {
  253. i = MLLoadStringA(IDS_AGNT_SMTPMESSAGE, szFormatText, NOTE_TEXT_LENGTH);
  254. ASSERT(i != 0);
  255. DWORD dwLen = lstrlenA(szFormatText) + 2*lstrlenA(szName) + lstrlenA(szURL) + 1;
  256. *szMessage = (LPSTR) MemAlloc(LPTR, dwLen * sizeof(CHAR));
  257. if (!*szMessage)
  258. return;
  259. LPSTR lpArgs[3];
  260. lpArgs[0] = lpArgs[1] = szName;
  261. lpArgs[2] = szURL;
  262. FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  263. szFormatText, 0, 0, *szMessage, dwLen, (va_list *)&lpArgs[0]);
  264. }
  265. }
  266. //
  267. // Use the MLANG apis to translate the string
  268. //
  269. // Returns success if translation occurred, fails otherwise
  270. //
  271. // Note if lpszSrcCharSet is NULL then use CP_ACP as the codepage
  272. //
  273. HRESULT TranslateCharset(
  274. LPSTR lpszSrcString, LPSTR lpszDstString, UINT uiDstSize,
  275. LPSTR lpszSrcCharset, LPSTR lpszDstCharset
  276. )
  277. {
  278. HRESULT hr = E_FAIL;
  279. WCHAR wszSrcCharset[ENCODING_STRLEN];
  280. WCHAR wszDstCharset[ENCODING_STRLEN];
  281. if (lpszSrcString == NULL || lpszDstString == NULL ||
  282. lpszDstCharset == NULL)
  283. {
  284. return E_INVALIDARG;
  285. }
  286. SHAnsiToUnicode(lpszDstCharset, wszDstCharset, ARRAYSIZE(wszDstCharset));
  287. if (lpszSrcCharset)
  288. SHAnsiToUnicode(lpszSrcCharset, wszSrcCharset, ARRAYSIZE(wszSrcCharset));
  289. LPMULTILANGUAGE2 pIML2 = NULL;
  290. //
  291. // Create the MLANG object
  292. //
  293. if (SUCCEEDED(CoCreateInstance (CLSID_CMultiLanguage, NULL,
  294. CLSCTX_INPROC_SERVER, IID_IMultiLanguage2, (void**)&pIML2)))
  295. {
  296. UINT srcCodePage = (UINT)-1, dstCodePage;
  297. MIMECSETINFO mcsi = {0};
  298. //
  299. // First get the source code page either from the passed in string
  300. // name of source Charset or from the default one if null if passed in
  301. //
  302. if (lpszSrcCharset == NULL)
  303. {
  304. srcCodePage = GetACP();
  305. hr = S_OK;
  306. }
  307. else
  308. {
  309. //
  310. // Use the mlang object to get the codepages
  311. //
  312. hr = pIML2->GetCharsetInfo(wszSrcCharset, &mcsi);
  313. if (SUCCEEDED(hr))
  314. {
  315. srcCodePage = mcsi.uiInternetEncoding;
  316. }
  317. }
  318. if (SUCCEEDED(hr))
  319. {
  320. hr = pIML2->GetCharsetInfo(wszDstCharset, &mcsi);
  321. if (SUCCEEDED(hr))
  322. {
  323. dstCodePage = mcsi.uiInternetEncoding;
  324. if (srcCodePage != dstCodePage)
  325. {
  326. //
  327. // To work around a bug in the Mlang::ConvertString api
  328. // have to pass in a ptr to length of the src string
  329. //
  330. UINT uiSrcSize = lstrlenA(lpszSrcString) + 1;
  331. DWORD dwMode = 0;
  332. hr = pIML2->ConvertString(
  333. &dwMode,
  334. srcCodePage,
  335. dstCodePage,
  336. (LPBYTE)lpszSrcString,
  337. &uiSrcSize,
  338. (LPBYTE)lpszDstString,
  339. &uiDstSize);
  340. }
  341. else
  342. {
  343. lstrcpynA(lpszDstString, lpszSrcString, uiDstSize);
  344. }
  345. }
  346. }
  347. pIML2->Release();
  348. }
  349. return hr;
  350. }
  351. //////////////////////////////////////////////////////////////////////////
  352. //
  353. // Mail notification implementation
  354. //
  355. //////////////////////////////////////////////////////////////////////////
  356. //
  357. // Notify via email that the pszURL has changed
  358. //
  359. // There are 3 ways to send via email -
  360. //
  361. // Use straight MAPI (IE Exchange or Outlook)
  362. // Most people don't have Exchange in the real world.
  363. //
  364. // Use Athena's MAPI implementation
  365. // It's broken and doesn't handle UI'less mode
  366. //
  367. // Use straight SMTP,
  368. // Need to get the name of an SMTP server
  369. //
  370. HRESULT
  371. NotifyViaEMail(
  372. LPSTR lpszURL, // url that was downloaded
  373. LPSTR lpszEmailAddress, // email address to send notification to
  374. LPSTR lpszSMTPServer, // SMTP server to use to deliver email
  375. LPSTR &lpszName, // friendly name of url (probably page title)
  376. LPSTR lpszTitle, // optional: NULL if not custom message
  377. LPSTR lpszAbstract, // optional: NULL if not custom message
  378. LPSTR lpszCharSet, // optional: charset of html page
  379. BOOL fSendHTMLEmail ) // TRUE if registry allows it and check mode
  380. // supports it.
  381. {
  382. BOOL b;
  383. LPSTR lpszSMTPMessage;
  384. //
  385. // lpszName comes from the title of the web page. If the charset of the page
  386. // is not the same as the one that this version of IE has been localized to
  387. // then we need to use the MLANG api's to coerce the string into the correct
  388. // charset
  389. //
  390. CHAR szTargetEncoding[ENCODING_STRLEN];
  391. MLLoadStringA(IDS_TARGET_CHARSET_EMAIL, szTargetEncoding, ARRAYSIZE(szTargetEncoding));
  392. //
  393. // Allocate buffer for new name. This is a conversion from one dbcs charset
  394. // to another so size shouldn't but to be safe use *2 multiplier.
  395. //
  396. UINT uiSize = lstrlenA(lpszName) * 2;
  397. LPSTR lpszNewName = (LPSTR) MemAlloc(LMEM_FIXED, uiSize * sizeof(CHAR));
  398. if (lpszNewName)
  399. {
  400. //
  401. // Note check for S_OK as will return S_FALSE if there is no appropriate
  402. // translation installed on this machine
  403. //
  404. if (S_OK == TranslateCharset(lpszName, lpszNewName, uiSize, lpszCharSet,
  405. szTargetEncoding))
  406. {
  407. //
  408. // if translation occurred alias new name to old name
  409. //
  410. SAFELOCALFREE(lpszName);
  411. lpszName = lpszNewName;
  412. }
  413. else
  414. {
  415. SAFELOCALFREE(lpszNewName); // don't need newname after all
  416. }
  417. }
  418. //
  419. // If we are requested to HTML mail and we successfully built the html
  420. //
  421. if (!(fSendHTMLEmail &&
  422. BuildHTMLMessage(lpszEmailAddress, lpszName, lpszURL, &lpszSMTPMessage,
  423. lpszTitle, lpszAbstract, lpszCharSet)))
  424. {
  425. //
  426. // If sending a simple notification or BuildHTMLMessage failed
  427. // force fSendHTMLEmail to false and build simple smtp message
  428. //
  429. fSendHTMLEmail = FALSE;
  430. BuildSMTPMessage(lpszName, lpszURL, &lpszSMTPMessage, lpszTitle, lpszAbstract);
  431. }
  432. //
  433. // Send message to given address and from given address
  434. //
  435. if (lpszSMTPMessage)
  436. {
  437. b = SMTPSendMessage(lpszSMTPServer, lpszEmailAddress,
  438. lpszEmailAddress, lpszSMTPMessage);
  439. MemFree(lpszSMTPMessage);
  440. }
  441. else
  442. {
  443. b = FALSE;
  444. }
  445. if (b)
  446. return S_OK;
  447. return E_FAIL;
  448. }
  449. //////////////////////////////////////////////////////////////////////////
  450. //
  451. // Helper function to send email
  452. //
  453. //////////////////////////////////////////////////////////////////////////
  454. HRESULT SendEmailFromItem(ISubscriptionItem *pItem)
  455. {
  456. HRESULT hr = E_FAIL;
  457. LPSTR pszURL = NULL;
  458. LPSTR pszName = NULL;
  459. LPSTR pszTitle = NULL;
  460. LPSTR pszAbstract = NULL;
  461. LPSTR pszCharSet = NULL;
  462. // Get the Email URL to send. Fall back to the download URL.
  463. ReadAnsiSTR(pItem, c_szPropEmailURL, &pszURL);
  464. if (!pszURL)
  465. ReadAnsiSTR(pItem, c_szPropURL, &pszURL);
  466. ASSERT(pszURL);
  467. // Get the friendly name. Fall back to the download URL.
  468. ReadAnsiSTR(pItem, c_szPropName, &pszName);
  469. ASSERT(pszName);
  470. if (!pszName)
  471. ReadAnsiSTR(pItem, c_szPropURL, &pszName);
  472. // Get Email Title and Abstract if flag is set.
  473. DWORD dwEmailFlags = 0;
  474. ReadDWORD(pItem, c_szPropEmailFlags, &dwEmailFlags);
  475. if (dwEmailFlags & MAILAGENT_FLAG_CUSTOM_MSG)
  476. {
  477. ReadAnsiSTR(pItem, c_szPropEmailTitle, &pszTitle);
  478. ASSERT(pszTitle);
  479. ReadAnsiSTR(pItem, c_szPropEmailAbstract, &pszAbstract);
  480. ASSERT(pszAbstract);
  481. }
  482. //
  483. // Get the charset in the notification
  484. //
  485. ReadAnsiSTR(pItem, c_szPropCharSet, &pszCharSet);
  486. // Get Email address and SMTP server
  487. TCHAR tszBuf[MAX_PATH];
  488. CHAR szEmailAddress[MAX_PATH];
  489. CHAR szSMTPServer[MAX_PATH];
  490. ReadDefaultEmail(tszBuf, ARRAYSIZE(tszBuf));
  491. SHTCharToAnsi(tszBuf, szEmailAddress, ARRAYSIZE(szEmailAddress));
  492. ReadDefaultSMTPServer(tszBuf, ARRAYSIZE(tszBuf));
  493. SHTCharToAnsi(tszBuf, szSMTPServer, ARRAYSIZE(szSMTPServer));
  494. // Send the email
  495. if (pszURL && pszName)
  496. {
  497. //
  498. // Check if HTML Mail notification is enabled or disabled thru the registry
  499. //
  500. BOOL fSendHTMLEmail = FALSE;
  501. if (!ReadRegValue(HKEY_CURRENT_USER, c_szRegKey,
  502. TEXT("EnableHTMLMailNotification"),
  503. &fSendHTMLEmail, sizeof(fSendHTMLEmail)))
  504. {
  505. fSendHTMLEmail = TRUE; // default to on if not read from registry
  506. }
  507. // Now make sure our crawling mode supports HTML mail. We don't
  508. // want to send HTML if we're in check-for-change only.
  509. DWORD dwTemp = 0;
  510. ReadDWORD(pItem, c_szPropCrawlChangesOnly, &dwTemp);
  511. if (dwTemp != 0)
  512. {
  513. fSendHTMLEmail = FALSE;
  514. }
  515. // else, leave fSendHTMLEmail in its reg-based setting.
  516. hr = NotifyViaEMail(pszURL, szEmailAddress, szSMTPServer,
  517. pszName, pszTitle, pszAbstract, pszCharSet,
  518. fSendHTMLEmail );
  519. }
  520. // Clean up.
  521. SAFELOCALFREE(pszURL);
  522. SAFELOCALFREE(pszName);
  523. SAFELOCALFREE(pszTitle);
  524. SAFELOCALFREE(pszAbstract);
  525. return hr;
  526. }